lua-users home
lua-l archive

Re: About big integers in Lua 5.3.

[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

AltStyle によって変換されたページ (->オリジナル) /