[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Unsigned Integer Literals?
- From: Muh Muhten <muh.muhten@...>
- Date: Mon, 3 Dec 2018 18:11:07 -0500
On 12/3/18, Magicks M <firstname.lastname@example.org> 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