[erlang-bugs] float parsing bug

Ulf Wiger <>
Sun Jan 10 20:31:22 CET 2010


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

Alexander Borovsky wrote:
> 
> 42.0 could have text representation "42".
> 
> In most languages (C, Java, Ruby, etc) "42" parsed to float with no errors.
> 
> Also in some cases float values could be outputted with no decimal point:

This is why I wrote "arguably". :)

The question has been up on the mailing list before:

http://www.erlang.org/cgi-bin/ezmlm-cgi?4:msp:15372:bkelgefglpkakhbedlbf
(May 12 2005)
http://www.erlang.org/cgi-bin/ezmlm-cgi/4/27647 (Jul 3 2007)
http://www.erlang.org/cgi-bin/ezmlm-cgi/4/37899 (Sep 4 2008)

In the last one, Richard Carlsson wrote:

  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.

But you're definitely not the first one to disagree with this design
decision.

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

iEYEARECAAYFAktKKwoACgkQtqqFieqzed3PSACfVOYTeSt9isb25zYygZg9RCXw
hGYAoKfAiYDMXnaljZh8gbPDmRVBZM1C
=0fkq
-----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