[erlang-questions] list_to_float/1 precision

Matthias Lang matthias@REDACTED
Sat Dec 16 14:14:19 CET 2006


Hoan Ton-That writes:

 > Is there a way to convert from strings to
 > floats that is more precise?
 > 
 > > list_to_float("-35.244818").
 > -35.2448

The conversion is more precise than you think, it's just the default
output precision which is confusing you:

 > io:fwrite("~f\n", [list_to_float("-35.244818")]).

Matthias



More information about the erlang-questions mailing list