lua-users home
lua-l archive

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


I just tested with the hexadecimal representation of the same number, which is 0x8000000000000000, and Lua correctly parses it as an integer.
So, it appears that only Lua's decimal parser is bugged.

On Fri, Feb 12, 2021 at 7:59 PM Lux Lang <luxlisp@gmail.com> wrote:
Hello, everyone.

I have found a bug in Lua 5.4.2.

The value of math.mininteger is the integer -9223372036854775808.
If you were to write the number itself, instead of accessing it through the math.mininteger constant, the Lua parser would instead produce the float -9.2233720368548e+18

This occurs both on the REPL, as well as when loading a Lua file.

Funny enough the value just next to math.mininteger, which is to say -9223372036854775807, correctly parses into an integer instead of a float. So it seems only math.mininteger suffers this bug. The value of math.maxinteger also correctly parses into an integer.

I can work around this bug, but I hope it's chosen to be fixed.

Best regards.