lua-users home
lua-l archive

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


2016-01-13 5:14 GMT+02:00 Xpol Wan <xpolife@gmail.com>:

> When writing a big integer bigger than INT64_MAX, lua 5.3 not correctly
> parsed:
>
> Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
>> print(9223372036854775808)
> -9223372036854775808
>
> Is this a bug or limitation?

Neither. It is in fact correct, provided that you understand
twos complement notation.

> math.maxinteger+1
-9223372036854775808
> string.format("%x",math.maxinteger+1)
8000000000000000