lua-users home
lua-l archive

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


Oh, I could only think about trapping long overflow to make variable-sized integers...


On 24 March 2014 02:07, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2014-03-23 21:09 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> This question comes from ignorance  and I'm sincerely curious:
>
> My understanding is that 5.3 internally flips to 64 bit signed when it sees
> that it's out of integer space in the double.

Well, let's test that,

$ lua53
Lua 5.3.0 (work2)  Copyright (C) 1994-2014 Lua.org, PUC-Rio
> x=1  -- 64 bit signed
> for k=1,54 do x=2*x+1 end
> x%2
1
> x=1.0 -- double
> for k=1,54 do x=2*x+1 end
> x%2
0.0

So your understanding is wrong.