I would like to see:
#define real float
...moved to Lua.h as Lua.h is included in files using the Lua interface
which may require the lua number type.
Could it be made a typedef?
Could it be given a more meaningful name, eg. lua_real or lua_number ? i.e.
because it might be used "outside" Lua.
typedef float lua_number;
Could you please cast all numbers that are used,
There are lots of warnings during compilation in Lua and the libraries. It
doesn't always cause problems, but can sometimes and anyway it should be a
clean build! :-)
Could all the client libraries use lua_number as the local type instead of
float or double. e.g. min and max.
If all this was done it would be very easy to change Lua between float and
double, and easier to change to int.
> If all this was done it would be very easy to change Lua between float and
> double, and easier to change to int.
Indeed. I got an unpleasant surprise the other day when I tried to
store a time_t in a Lua number. I wound up putting it in a string,
which was OK because I was writing C code, but it would have been
tough to handle in Lua code alone.
Has anybody written a library to do arbitrary-precision arithmetic on
strings? If not, adapting Dave Hanson's code at
http://www.cs.princeton.edu/software/cii might not be hard...