[erlang-questions] floating point syntax

Robert Virding <>
Thu Apr 15 18:30:45 CEST 2010


Yes, it is supposed to be like that, no, it is not a bug. Floats
consist of both parts before and after the decimal point and an
optional exponent.

Robert

On 15 April 2010 16:21, Anthony Shipman <> wrote:
> The reference manual says "There are two types of numeric literals, integers
> and floats. Besides the conventional notation,..."
>
> But what is the "conventional notation" exactly? I find that this fails:
> 19> io_lib:fread("~f", "1e+2").
> {error,{fread,float}}
>
> Also
> 1.e+2 fails
> 1     fails
> 1.    fails
> 1.0   succeeds
> .1    fails
> 0.1   succeeds
> 1.0e+2 succeeds
>
> Is it supposed to be like that or is there a bug?
>
> --
> Anthony Shipman                    Mamas don't let your babies
>                    grow up to be outsourced.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list