|
Hi all, I have seen that there are already a few posts on that subject on the list archives, however I did not find a conclusion. The fact is that the function lua_number2integer has a behavior which is really too random, depending on which platform lua is running. The header of the macro specify indeed that the rounding method is not defined. In my opinion this lead to an unacceptable portability issue. Here is the code which revealed the unconsistency of the number to integer process: string.char(112+remaining/256, remaining%256) where remaining was taken from 0 to 4095. This code was done assuming that the string.char function was "correctly truncating" the value as C would do it in such a case. To enlight the problem: Here is what I get on Ubuntu 8.04 32 bits: Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-RioHere is what I get on Windows XP 32 bits, (lua compiled with MSVC) Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-RioAny comments ? Regards, Cuero --
|