[NTG-context] integer displayed as .0 float in Lua-5.3

Hans Åberg haberg-1 at telia.com
Thu Aug 9 22:20:11 CEST 2018


> On 9 Aug 2018, at 21:20, Pablo Rodriguez <oinos at gmx.es> wrote:
> 
>  A numeric constant with a radix point or an exponent denotes a
>  float; otherwise, if its value fits in an integer, it denotes an
>  integer.
> 
> Well, "10.0" contains the radix point, but with no arithmetical relevance.
> 
> My background is in humanities and I don’t understand the exponent for
> being a float ("10²" contains an exponent
> [https://www.m-w.com/dictionary/exponent], but I would say is an integer
> in all possible worlds [or all the worlds I know ]).
> 
> Could anyone explain me what am I missing here or confirm whether this
> is a bug?

It may refer to a floating point number syntax as in C++ [1], where the three cases top there say that there must be a point '.' preceded or followed by at least one digit, or at least one digit followed by an exponent starting with 'e' or 'E'. There are also some examples on that page. Also note that there are no negative numbers, which is because a leading + or - are treated as operators that apply not only to numbers.

1. https://en.cppreference.com/w/cpp/language/floating_literal




More information about the ntg-context mailing list