lua-users home
lua-l archive

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


Oh yes, another detail, regarding the math standard library.
When defining USE_FLOAT, the math primitives remain the double-precision
versions (sin, cos, etc.), instead of being the single precision ones (sinf,
cosf, etc.)
This results in several unnecessary double <-> float conversions.

Also, no check on the lua_Number type is performed. I suspect that math
library would not work well with USE_LONG :-)

It would be nice to add something like this to the official lmathlib.c:

#if defined ( USE_FLOAT )
#define SIN sinf
#define COS cosf
...
#elif defined ( USE_DOUBLE )
#define SIN sin
#define COS cos
...
#else
#error "some message"
#endif


> -----Original Message-----
> From: Luiz Henrique de Figueiredo [mailto:lhf@tecgraf.puc-rio.br]
> Sent: mercredi 30 octobre 2002 21:34
> To: Multiple recipients of list
> Subject: Re: switching from double to float
> 
> 
> >I recently downloaded Lua 5.0 alpha and am trying to convert 
> the code 
> >to use floats instead of doubles. 
> 
> The file config explains how to do that if you're using make.
> 
> I don't know what to do in MS Dev Studio but you'll have to
> #define LUA_USER_H to be "../etc/luser_number.h" (no quotes)
> and also to #define USE_FLOAT .
> 
> --lhf
>