[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with formatting large integers
- From: Adam Strzelecki <ono@...>
- Date: Fri, 15 Apr 2011 23:38:26 +0200
> ( assuming, of course, that 2^31 falls within the range of integers
> which can be represented exactly in the particular Lua implementation;
> this is certainly the case in the original posting )
Nah it doesn't, 31 bits for value + 1 bit for sign, makes 2^31-1 a maximum value you can represent with 32-bit integer. While the result you get -2147483648 is exactly 2^31 casted to 32-bit int, sign bit = 1, value bits all zero 0.
--
Adam Strzelecki