[erlang-bugs] Sum small floats and get erroneous result in R12B-2

Hans Bolinder hans.bolinder@REDACTED
Thu May 29 09:06:54 CEST 2008


[Badlop:]
> 2> 20.15 + 2.01.
> 22.159999999999997
[...]
> But the results of 2 [...] look strange.

The floats representing 20.15 and 2.01 are not exactly equal to 20.15
and 2.01 respectively. The sum is some other float than the one
representing 22.16.

Floats are printed accurately as the shortest, correctly rounded
string. This is a new feature in R12B-2; io(3) erroneously states that
the default g format is used, but that will be corrected in R12B-3.

Best regards,

Hans Bolinder, Erlang/OTP team, Ericsson



More information about the erlang-bugs mailing list