Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix incorrect results in string-returning methods of Rationals
Fixes RT#126016: https://rt.perl.org/Ticket/Display.html?id=126016 The issues observed in the ticket result from floating point math noise when handling the fractional part after splitting the Rational into whole part and fractional parts. That fractional part remains a Rat, and when further operations on it coerce it into a Num, the f.p. math noise results in it being a whole number, but still treated under the assumption of being less than 1. Fix by checking for that case and adjusting fractional/whole parts accordingly. Also, fix Rat.perl.EVAL roundtrip for Rats that end up not being equal to the original Rat due to f.p. math noise by outputting those in <nu/de> notation. Performance impact of this commit: Rational.Str about 40% faster, Rational.base about 30% faster, Rat.perl 5% slower
- Loading branch information