8 ms·
> Several of the results surprised me. Did they surprise you? Well, the perl6 result surprised me, since that means it's using something more precise than doub
by Aardwolf 8y ago
> Several of the results surprised me. Did they surprise you?
Well, the perl6 result surprised me, since that means it's using something more precise than double precision floating point :)
- lizmat 8y agoThey're called Rat (for Rational number): https://docs.perl6.org/type/Rat https://docs.perl6.org/type/Rat , which maintain precision until the denominator exceeds 64 bits: then they're downgraded to doubles. If you want to keep precision still at that level, you can use FatRat: https://docs.perl6.org/type/FatRat https://docs.perl6.org/type/FatRat
- _kst_ 8y agoIt surprised me too, since it's not what I got. $ perl6 --version This is Rakudo version 2018.03 built on MoarVM version 2018.03 implementing Perl 6.c. $ perl6 -e 'print 9999999999999999.0-9999999999999998.0;print "\n";' 2 $ (Incidentally, I would have used "say" rather than "print" with an explicit newline.)
- lelf 8y ago› perl6 -e '.say for $*PERL.compiler, 9999999999999999.0-9999999999999998.0' rakudo (2018.11) 1
- lizmat 8y agoIndeed, there was a bug with determining when to switch to floats, that was fixed by Zoffix in August: https://github.com/rakudo/rakudo/commit/fec1bd74f97e257d4c88673cd62fdcae39f587a3