[erlang-questions] list_to_float()
Richard Carlsson
richardc@REDACTED
Thu Sep 4 14:50:13 CEST 2008
Alpár Jüttner wrote:
> I've just noticed that
>
> 1> list_to_float("22").
> ** exception error: bad argument
> in function list_to_float/1
> called as list_to_float("22")
>
> Is this a bug or a feature?
It's a "feature": list_to_float/1 is a rather low level function,
which assumes that you have already checked that the string has the
proper form for an Erlang float, i.e., "0.0" and "1.0E-3" are ok,
but "22", ".0", and "0." are not.
/Richard
More information about the erlang-questions
mailing list