Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.0
-
None
-
None
Description
The current implementation of Fraction.floatValue() first calls doubleValue(), which converts the fraction to a double with maximum possible precision, and then rounds the returned double value to a float. For the fraction 1 + 26 / (230 - 1) = (230 - 1 + 26) / (230 - 1), this yields a result of exactly 1. However, the actual value of the fraction is closer to 1 + 2-23 (which is representable exactly as a float) than it is to 1, as WolframAlpha confirms.