[erlang-bugs] float parsing bug

Ulf Wiger ulf.wiger@REDACTED
Sun Jan 10 18:58:42 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Borovsky wrote:
> Release: R13B03
> 
> Steps to reproduce:
> 1) erlang:list_to_float("42")
> 
> Expected result:
> 42.0 (float)
> 
> Actual result:
> error:badarg

Arguably, this is in line with the documented behaviour:

"list_to_float(String) -> float()

Types:
String = string()

Returns the float whose text representation is String.

> list_to_float("2.2017764e+0").
2.2017764

Failure: badarg if String contains a bad representation of a float."


There is no float that has the text representation "42".

Eshell V5.7.2  (abort with ^G)
1> is_float(42).
false


BR,
Ulf W
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktKFVIACgkQtqqFieqzed2K+wCeN/rCVoLwk8XFBIxffc/RZHD8
oPIAn2O+NCdfBrGzkB9kJEHVTmX//uKk
=7LZ7
-----END PGP SIGNATURE-----
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-bugs mailing list