lua-users home
lua-l archive

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


>I'm looking to compile an entirely floating point lua and have started
>with LUA_NUM_TYPE=float

That should be sufficient.
The only explicit doubles occur in the API, where they should not be a problem.

>and then progressed to replacing cases of double within the rest of the code.

Why?
The main reason for using float instead of double is to reduce memory use,
Someone in the list mentioned that doubles in some machine were very slow.
I'd like to hear more about this.

>Conversion from float to integer and integer
>to float both cause some concern as large int's will become
>innacurate.

Well, you can't have it both ways.
Lua was originally in float, but we moved to double exactly to be able to
represent 32-bit integers.

>This behaviour is used in some of the Hashing code and I am
>reluctant to go on from here as I don't wish to rewrite large portions of
>the lua code and even if I do I'm likely to make mistakes.

I don't see where it could break. There are casts in the appropriate places.
Actually, I don't see why you'd have to change anything at all.

Anyway, I think that changing every occurence of double to float is harmless,
except that you need to be careful with scanf formats.
See my previous post in using long instead of double.
--lhf