Lookery Dev Blog RSS

"Stream of geeky consciousness..." @electromute


Authors
@ckelly@danmil
@dcancel@eliast

Friends


Archive

Oct
13th
Mon
permalink

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

Comments (View)
blog comments powered by Disqus