lua-users home
lua-l archive

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


On Mon, Sep 26, 2016 at 9:04 AM, gs <schuler.101@gmail.com> wrote:
> I am relatively new to Lua, so please bear with me.
>
> On Lua 5.2:
>> io.write(string.format("%d\n", tonumber("5c7d528b825b090", 16)));
> 416535861419946112
>
>
> On Lua 5.3:
>>  io.write(string.format("%d\n", tonumber("5c7d528b825b090", 16)));
> 416535861419946128
>
> The latter is the correct answer.
>
> (1) Am I doing something wrong in Lua 5.2. I am relatively new to Lua, and
> did not see an explicit mention of this being  fixed in 5.3 , so, I am not
> sure if there is an actual bug in 5.2.
> (2) For some reason, I can't upgrade to 5.3 (due to policies outside my
> control). Is there a workaround to get the right answer in 5.2?
>
> Thanks
>

Lua 5.2 doesn't have 64-bit integer support; its precision caps out at 53 bits.

/s/ Adam