On Fri, 20 Oct 2017 07:34:04 -0700, victor.a...@derpymail.org wrote: > How to reproduce > ---------------- > > perl6 -e 'my ($a, $b) = (0.777777777777777777777, > 0.7777777777777777777771); say $a <=> $b, " ", Num($a) <=> Num($b)' > > Expected behavior > ----------------- > > Prints `Less Less`, or `Less Same`, depending on how rounding is done. > > Actual behavior > --------------- > > Prints `Less More`. This seems inconsistent: $a is strictly smaller > than $b, yet Num($a) is strictly larger than Num($b). > > Version information > ------------------- > > This is Rakudo version 2017.09 built on MoarVM version 2017.09.1 > implementing Perl 6.c. > > This may be related to https://rt.perl.org/Public/Bug/Display.html?id=132313
Thank you for the report. This is now fixed (specifically, the Num version now gives "Same" as there's not enough precision available to represent those Rats as different numbers) Fix: https://github.com/rakudo/rakudo/commit/a760ac3cfc6426d9bd2fb00db https://github.com/MoarVM/MoarVM/commit/b735866ddee9bd719440e5c82 Test: https://github.com/perl6/roast/commit/db0c58b5f763b085e On Fri, 20 Oct 2017 17:44:40 -0700, c...@zoffix.com wrote: > This appears to be not a bug but simply the goodness of floating point > math. I get the same result in C: You're wrong, 2017-Zoffix. The result you got in C is because you incorrectly used doubles to do the division.