lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 12/3/18, Magicks M <> wrote:
> Quoting from Programming in lua:
>> We can write constants larger than 2^63 -1 directly, despite appearances:
>   > x = 13835058055282163712 -- 3 << 62
>  > x                        --> -4611686018427387904
> When I enter this example into an interpreter (you can try in the lua demo)
> the number is cast to a float, is that supposed to happen?

Since this numeric constant has neither radix point nor exponent, and
does not fit in an integer, it is not defined by the manual (§3.1):

> 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.

The claim in PIL is consistent with 5.3.0-2, but changed in 5.3.3. The
manual text in that section is the same. Of course, pre-5.3 versions
generally have the "new" behaviour due to using only floating-point