Oct
13th
Mon
13th
Parsing Floats in Erlang = WTF
Consider the following zen koan of awful:
116> string:to_float("20").
{error,no_float}
117> string:to_float(".20").
{error,no_float}
118> string:to_float("20.0").
{20.0,[]}
119> string:to_float("0.20").
{0.2,[]}
I don’t think I can fully convey my disgust/amazement — Erlang can’t parse “20” as a float? Wait, how did that happen?
(Oh, and, btw, yes, using erlang:list_to_float give the same horrific results)
-Dan M

