lua-users home
lua-l archive

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



Depends on your need of maths, since things s.a. sin, cos et.al. will lose their usefulness pretty immediately. I would actually leave such undefined for a fixed-point Lua implementation.

The C API would be problematic; unless you keep 'lua_Number' as a familiar double and only do the conversion within the core. You wouldn't be aware of how addon modules deal with lua_Number, and you wouldn't really even want to know. :) This means you wouldn't just get away with redefining LUA_NUMBER.

If you get it to work, I'd be interested to add fixed point maths into the Numbers patch. And to hear performance comparisons against a hybrid float+int32 approach.

-asko


Enrico Colombini kirjoitti 16.10.2007 kello 10:49:

What sort of traps could I fall into if I redefine LUA_NUMBER to use a fixed-point type behaving as a float?

(the highest integer value for this type would be much smaller than an int's)

  Enrico