floating point syntax

Robert Virding rvirding@REDACTED
Mon Apr 19 23:16:02 CEST 2010


IIRC it was probably more that we/I just didn't see the need to be
able to write the shortened forms. It isn't that it is much extra you
have to write. :-)

Robert

On 16 April 2010 18:26, Michael Turner <leap@REDACTED> wrote:
>
> I guess this has something to do with the fact that a period is also a
> terminator in Erlang syntax.  If you allowed "1." as a legal float,
> for example, you're permitting this:
>
>  fp1() -> 1..
>
> And with
>
>  f() -> 1.e5;
>
> you need a bit more token lookahead (since "e5" could be seen as the
> start of a new function).  My guess, as I say.
>
> -michael turner
>
> On 4/15/2010, "Robert Virding" <rvirding@REDACTED> wrote:
>
>>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 <als@REDACTED> 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
>>> als@REDACTED ? ? ? ? ? ? ? ? ? grow up to be outsourced.
>>>
>>> ________________________________________________________________
>>> erlang-questions (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>>
>>>
>>
>>________________________________________________________________
>>erlang-questions (at) erlang.org mailing list.
>>See http://www.erlang.org/faq.html
>>To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>>
>


More information about the erlang-questions mailing list