lua-users home
lua-l archive

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


On 28/07/2011 11.27, Florian Weimer wrote:
* Xavier Wang:

2011/7/28 Florian Weimer<fw@deneb.enyo.de>:
* Norman Ramsey:

The first law holds, but if n is sufficiently large, the second does not:

     : nr@labrador 12309 ; lua
     Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

Whay kind of architecture do you use?  It works for me as expcted with
Lua 5.1.4 on Debian squeeze amd64.

Obviously he is on a 32x machine :)  -2147483648 == -2^32

Not so obvious.  %d expects an int argument, which is 32 bit on amd64,
too.  Perhaps the C varargs calling convention is fixing things up on
amd64, but I'm not sure.



It doesn't work for me:

-- Lua 5.1.4 on Windows XP (SP2)
-- CPU: Intel Mobile Core 2 Duo T7500
x = 2^31
print( ("%.0f     %d"):format(x,x) )
--> 2147483648     -2147483648



-- Lorenzo