|
From: | nicolas cellier |
Subject: | [Help-smalltalk] BUG gst2.2: Float asExactFraction asFloat inexact |
Date: | Sat, 27 Jan 2007 02:37:29 +0100 |
User-agent: | Thunderbird 1.5.0.4 (X11/20060516) |
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 = xMore over, denormalized number (gradual underflow) will convert back to zero...
| x | x := 1.1d-310. ^x asExactFraction asFloat = 0 Nicolas Cellier
[Prev in Thread] | Current Thread | [Next in Thread] |