[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Bug in Lua when using signed long
- From: Florian Weimer <fw@...>
- Date: Sun, 13 Dec 2009 15:13:30 +0100
> It's not a bug, it's natural. lua_Number as "double" is 64 bits long,
> part of which is exponent. Redefine lua_Number as "long double" if you
> want it to hold 64-bits integers. AFAIR, you'll also have to redifine
> another constant together with lua_Number.
And what's apparently happening is that 2**63 - 1 has the same
representation as 2**63, which is -2**63 (mod 2**64). (Just to
clarify, in case this isn't obvious).