OTP: erlang:list_to_float

Matthias Lang matthias@REDACTED
Thu May 12 11:26:47 CEST 2005

Alexander Williams writes:

 >   Is it really INTENDED that erlang:list_to_float("3") blows up with a
 >   badarg?  I  mean,  yes,  in  theory I could go looking through for a
 >   period  before  passing  data  in,  but  that  seems  a  little  ...
 >   complicated for something that's not truly a bad argument.

According to the draft erlang spec, "3" is not a valid representation
of a float literal. See section 3.12 of


I'm guessing that float_to_list/1 follows the same rules, and that
doesn't seem so odd. I was a bit surprised that io_lib:fread("~f",
"3") doesn't give me the float 3.0000, though.

While on the subject of punctuation, you're missing the ':' after 'http'
in your sig:

 > The Squid's Redoubt: http//chancel.org:8000/Redoubt


More information about the erlang-questions mailing list