Converting a Fraction to a Float is generally inexact. That's OK. Float are inexact (rounded).

But that should not be the case for Fraction with 53bit numerator and denominator power of two, as obtained with asExactFraction.

Unfortunately, current implementation of both Largeinteger>>asFloat and Fraction>>asFloat will cause successive round off errors...

| x |
x := 0.510000001d-20.
^x asExactFraction = x


More over, denormalized number (gradual underflow) will convert back to zero...

| x |
x := 1.1d-310.
^x asExactFraction asFloat = 0

Nicolas Cellier



_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to