Re: problem with string.format %d and very large integers
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: problem with string.format %d and very large integers
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: 2011年7月29日 09:22:33 +0200
On 27/07/2011 23.10, Luiz Henrique de Figueiredo wrote:
> =big
2500000000
> =string.format('%d', big)
-2147483648
This works fine in 5.2:
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
big=2500000000
=string.format('%d', big)
2500000000
Well, now I'm really puzzled. I tested again:
x = 2^31
print( ("%.0f %d"):format(x,x) )
on 5.2.0-alpha and all the betas (rc1 through rc7).
and I keep getting the same results:
--> 2147483648 -2147483648
Since the issue should have been fixed in 5.2, either I'm doing
something really silly or my toolchain has something wrong. Could it be
that msvcrt.dll has some issue that mingw cannot work around?
Is there someone else that gets the same results on WinXP (32bit) with
(TDM) mingw?
Any hint appreciated.
-- Lorenzo