In perl6 version 2017.04.3-287-g3e7675a built on MoarVM version 2017.04-64-g6d5ea04
implementing Perl 6.c. I observe the following;

my Num $num = Inf;
my FatRat $f = $num.FatRat;
Type check failed in assignment to $f; expected FatRat but got Rational[Num,Int] (?)
  in block <unit> at <unknown file> line 1

Inf.WHAT;                    # (Num)
Inf.FatRat.WHAT              # (Rational[Num,Int])

It boils down to not converting to FatRat while a defined number does;
my Num $num = 2.3e3;
$num.FatRat.WHAT;            # (FatRat)

This is the same for NaN.

If this is defined behavior, then there is no way to set NaN or Inf for FatRat (and for Rat too). Is there another way to accomplish this?


Reply via email to