[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA_NUM_TYPE long
- From: "Nick Trout" <nick@...>
- Date: Fri, 16 Jul 1999 10:40:14 +0100
I agree. If real is defined then all usage of floating point should of type
real and all values should be cast to this. Why make life difficult for the
user? It's not as though going through the code and doing this and removing
all the warnings the the none casting causes will break Lua or make it more
unreadable.
N
----- Original Message -----
From: Adam Wozniak <adam@mudlist.eorbit.net>
To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
Sent: Thursday, July 15, 1999 10:24 PM
Subject: Re: LUA_NUM_TYPE long
>> 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
>