Closed rbt closed 1 year ago
I think this is probably a precision issue in the output, rather than a problem with the actual stored FatRat.
'-0.1234567890123456774144'.FatRat.nude (-588687844335297 4768371582031250)
(switch to bc) scale=50 -588687844335297/4768371582031250 -.12345678901234567741440000000000000000000000000000
So it has the correct numerator and denominator internally, it's just not displaying all the digits when you output it.
--Sol
On Fri, Nov 25, 2022 at 3:51 PM rbt @.***> wrote:
This occurs at the boundary of what a Rat can handle.
say '-0.1234567890123456774144'.FatRat;
-0.123456789012345677 # Incorrect. Lost 4144
say '-0.123456789012345677414400000000000001'.FatRat;
-0.123456789012345677414400000000000001 # Correct. Even larger value is maintained
Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.
— Reply to this email directly, view it on GitHub https://github.com/rakudo/rakudo/issues/5108, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANN2ELOYUUWDS453464GLWKERE7ANCNFSM6AAAAAASLTRHVM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Solomon Foster: @.*** HarmonyWare, Inc: http://www.harmonyware.com
For the interested: this seems to be the method that produces the actual output: https://github.com/rakudo/rakudo/blob/63ead8d3d230010a6a5837be02437a202aea56b2/src/core.c/Rational.pm6#L112
This occurs at the boundary of what a Rat can handle.