lua-users home
lua-l archive

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


Hi,

Adam D. Moss wrote:
> [...] because changing lua_Number is exactly what I did.

Maybe it is worth repeating here that this is NOT a good idea, anyway
(even if compiled properly).

At least on any general purpose CPU (x86, PPC, ...) that has been
manufactured in the past 10 years. While it is tempting to change
lua_Number to float or long, it has almost no effect on performance
and may have very bad side-effects ...

Thankfully Martin Hollis took the trouble to write it all down in the Wiki:

http://lua-users.org/wiki/FloatingPoint

[
If anyone reading this is still a die-hard integer-only-advocate:
Please take a look at the source for the integer math operations in Python.
This is in Objects/intobject.c ... you may be in for a big surprise.

Integers are fine for many things -- but not for a general purpose
number type in a language like Lua.
]

Bye,
     Mike