On Thu, Apr 14, 2011 at 10:01 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> Does there exist a version of Lua 2.5 suitably modified to use double-precision floats?
No, but the hack below complies and seems to work fine on bisect.lua.
You probably need to change some more floats to double just to be sure.
In particular, check parser.c. If you need to load precompiled chunks,
then undump.c will require some work. If you need to precompile chunks,
so will dump.c. Actually, I think all those floats should be real, as
defined in types.h.
If you need help, please ask.
--lhf
diff -r lua-2.5/include/lua.h lua-2.5-double/include/lua.h
63c63
< float lua_getnumber (lua_Object object);
---
> double lua_getnumber (lua_Object object);
69c69
< void lua_pushnumber (float n);
---
> void lua_pushnumber (double n);
diff -r lua-2.5/src/types.h lua-2.5-double/src/types.h
12c12
< #define real float
---
> #define real double
I made the changes you suggested, as well as changes in all the other files that mention `float': most of the changes were mechanical, and it was only in dump.c and undump.c where more care was required. It all seems to work!
Thanks for the quick and helpful response.