lua-users home
lua-l archive

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


> From lua-l@tecgraf.puc-rio.br  Thu Jul 15 14:55:49 1999
> From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
>
> > There are far too many internal dependancies on the number type being
> > a floating point type.
>
> How many is far too many? I personally only know about four or five places 
> where Lua assumes that numbers are float, outside the math library. 

lapi.c:double lua_getnumber (lua_Object object)
lapi.c:void lua_pushnumber (double n)
lauxlib.c:double luaL_check_number (int numArg)
lauxlib.c:double luaL_opt_number (int numArg, double def)
lmem.c:#define HEADER   (sizeof(double))
lobject.c:static double expten (unsigned int e) {
lobject.c:  double exp = 10.0;
lobject.c:  double res = 1.0;
lobject.c:double luaO_str2d (char *s) {  /* LUA_NUMBER */
lobject.c:  double a = 0.0;
lundump.c:double luaU_str2d (char* b, char* where)
lundump.c: double x=luaO_str2d(b+negative);
lvm.c:    double t;
lvm.c:    sprintf(s, "%.16g", (double)nvalue(obj)); 

I think one would be far too many.  If you're going to litter the
code with 'double', what is the point of having LUA_NUM_TYPE ?

--Adam