in reply to Re^11: Small Perl 6 discoveries II, Rats
in thread [Perl6] Small discoveries I, __DATA__
First, Rats aren't FatRats and vice-versa.They're both Rational, but that's still not very useful.
The argument type-coercion is cute, but there doesn't seem to be any way to set the precision.> my Rational $x = 1.111111111111111111111; 1.11111111111111111604544 > $x *= 0.1; Type check failed in assignment to $x; expected Rational but got Num ( +0.111111111111111e0)
And I don't know how to interpret this message...> sub foo(FatRat() $x) { return $x }; foo(pi).nude (355 113) > pi.FatRat(1e-8).nude (103993 33102)
> my FatRat() $x = 0.1; ===SORRY!=== Error while compiling: Coercion FatRat(Any) is insufficiently type-like to qualify a variable ------> my FatRat() $x⏏ = 0.1; expecting any of: constraint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: Small Perl 6 discoveries II, Rats
by raiph (Deacon) on Oct 27, 2017 at 20:19 UTC | |
by Anonymous Monk on Oct 28, 2017 at 06:35 UTC |