[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: At the edge of LNUM patch
- From: Ralph Hempel <rhempel@...>
- Date: Tue, 25 Mar 2008 09:57:55 -0400
Roberto Ierusalimschy wrote:
Besides, the idiosyncrasies of IEEE floating point are well studied (one
can say they were even well designed) and documented. To add a new set
of idiosyncrasies into Lua arithmetic opens a whole new world...
I have to agree here - without diminishing the usefulness of the LNUM
patch for some applications. Right now, the Lua math works fine for
For one of my applications, which is a port of Lua to LEGO MINDSTORMS
NXT running on an ARM7 core, I decided that 32 bit int was a good choice
for the fundamantal numeric type.
I was able to add single precision float math using a library of C
code, but kept using 32 bit integers as the basic number system.
The programmer has to make an explicit conversion of a number to
a float, and is therefore responsible for using the resulting
number correctly :-)
As Roberto points out, the IEEE floats have some neat properties, and
the one that always amazes me is that integer magintude comparisons
such as greater or less than work on floats...