float_to_list question

Pierpaolo BERNARDI <>
Sat Dec 30 21:53:41 CET 2000


On 30 Dec 2000, Mickael Remond wrote:

> I must be missing something but here is what I get from the float_to_list
> built-in function:
...
>  13> float_to_list(1.1).
>  "1.10000000000000008882e+00"
> 
> Oh Oh. I was expecting:
> "1.10000000000000000000e+00"

1.1 and 1.2 are not representable with the standard floating point
formats.  The strings you get are (hopefully) the decimal representations 
of the floats closest to 1.1 and 1.2.

P.




More information about the erlang-questions mailing list