lua-users home
lua-l archive

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


In message <4815F4D6.1050100@hempeldesigngroup.com> you wrote:


> 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.

I had a similar experience with RiscLua ( http://lua.riscos.org.uk/ ),
a port to a platform based on ARM architecture chips with only
software support for floating point. I tried various shifts to have
my cake (32-bit integers for standard integers) and eat it (also
have some fp facilities). I tried the mapm library and decided nobody
would use it. In the end I did the same as you, and implemented
arithmetic with doubles via userdata. I also extended the Lua VM with
bitwise operations. See history at
http://www.wra1th.plus.com/lua/version.html .

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/