[Ecls-list] Rounding bug in float
Robert Dodier
robert.dodier at gmail.com
Mon Mar 30 17:52:36 UTC 2009
On Tue, Mar 24, 2009 at 10:41 PM, Raymond Toy <toy.raymond at gmail.com> wrote:
> With ecl 8.12.0 on Linux, I get
>
> (float (/ (1- (ash 1 100)) (ash 1 100)) 1d0) -> .999999...99d0
>
> I think the answer should be 1d0 since the difference between 1 and the
> rational above is far less than double-float-negative-epsilon. Both
> clisp and cmucl produce 1d0.
I'm surprised the CLHS doesn't offer any guidance here.
About FLOAT, it says only "If a prototype is supplied, a float is returned that
is mathematically equal to number but has the same format as prototype."
Nothing about what to do when there is no float which is mathematically
equivalent to the argument.
CLHS goes on to say "Exceptional Situations: None." so FLOAT must
return a value ....
FWIW
Robert Dodier
More information about the ecl-devel
mailing list