[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floating point lua
- From: Jonathan Adamczewski <jadamcze@...>
- Date: Fri, 24 Nov 2000 11:04:02 +1100 (EST)
On Thu, 23 Nov 2000, Luiz Henrique de Figueiredo wrote:
> >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.
For heavy maths (in this case 3D on x86), using exclusively floats for
floating point maths can provide better performance. (yeah, I know - a
marginal difference but why not try)
> >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.
I know :)
> Lua was originally in float, but we moved to double exactly to be able to
> represent 32-bit integers.
That is quite clear.
> >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.
Ok, the previous comment was made without looking too deeply at the code -
everything looks remarkably safe. My sincerest apologies for doubting any
part :)
> 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.
The post has been read and noted. Thanks.
Jonathan.