[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: modifying lua for table indexing with fixed point variables
- From: Ralph Hempel <rhempel@...>
- Date: Mon, 28 Apr 2008 12:01:26 -0400
Gregory Lamoureux wrote:
I've modified Lua to work using only fixed point 32 bit integers. ie,
any number entered in a script or interpreter is automatically
intercepted and converted to fixed point values (1e10 -> 655360,
0x0002->131072, etc..). Most of the changes were made to luaconf.h, but
there were two other issues I had to fix:
There are probably a few more that you may not have run into
yet either :-)
I've been down this road too, using standard 32bit long as the
fundamental number type and then trying to wedge single precision
floats in as a special case.
After about a year of messing around, I came to the conclusion that
the times that I need floats are generally well known, and the user
has to think about when to use them as well, so why not just make
them a special userdata type with a metatable to deal with the
common arithmetic operators.
Would this apply to your situation as well, or is the use of
fixed point math so pervasive in your application?