lua-users home
lua-l archive

Re: 5.3 unsigned fall-over?

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


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.

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