lua-users home
lua-l archive

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


On 7/29/2011 3:22 PM, Lorenzo Donati wrote:
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?

WinXP, MinGW gcc 4.5.2 (TDM)

In luaconf.h, LUA_WIN does not define LUA_USE_LONGLONG. So in lstrlib.c, LUA_INTFRM uses 'l'/long instead of 'll'/long long.

IIRC, 'll' does not work for msvcrt.dll.

Behaviour is the same for official MinGW gcc 4.5.2.

Would be nice to have proper behaviour on MinGW...

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia