Bug 40033

GemStone/S

6.5.2, 6.5.1, 6.5, 6.3.1, 6.3, 6.2.x, 6.2, 6.1.5

All

6.5.4

Small inaccuracy in Float to Fraction conversion

Certain Float values, when converted to Fraction, produced results that did not exactly correspond to the Float. Binary Float cannot represent all Decimal Floats, while any Float can be exactly represented by some Fraction.

For example, '7.6' asFloat asFraction returned (38/5), which is incorrect; it should return (4278419646001971/562949953421312).
7.6 is not exactly representable as a BinaryFloat; the closest Float equivalent is 7.5999999999999996E+00. So, this conversion necessarily
and inevitably introduces a small inaccuracy in the result. When this resulting BinaryFloat is converted to a Fraction in a subsequent operation, this inaccuracy must be retained, since Float to Fraction conversions can and should be exact.


Last updated: 10/14/09