lua-users home
lua-l archive

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


On Thu, Jun 18, 2015 at 12:20 PM, James Chang <jcchang92@gmail.com> wrote:
>>
>>
>> > print(string.format('%d', 2^63))
>> 9223372036854775807 [[ = 2^63 - 1 ]]


previously to Lua 5.3, all numbers in Lua were stored and managed as
double float quantities (unless you tweak and compile Lua yourself).
that means scientific format numbers: a mantissa and an exponent.
double floats have 52 bit mantissas, meaning that you only get integer
precision up to 2^52.  beyond that, you can still express big
quantities, but you lose precision.

-- 
Javier