lua-users home
lua-l archive

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


How are the following configuration options not sufficient in this area?

#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER	double
#define LUAI_UACNUMBER	double
#define LUA_NUMBER_SCAN		"%lf"
#define LUA_NUMBER_FMT		"%.14g"
#define lua_number2str(s,n)	sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR	32 /* 16 digits, sign, point, and \0 */
#define lua_str2number(s,p)	strtod((s), (p))
#define luai_numadd(a,b)	((a)+(b))
#define luai_numsub(a,b)	((a)-(b))
#define luai_nummul(a,b)	((a)*(b))
#define luai_numdiv(a,b)	((a)/(b))
#define luai_nummod(a,b)	((a) - floor((a)/(b))*(b))
#define luai_numpow(a,b)	(pow(a,b))
#define luai_numunm(a)		(-(a))
#define luai_numeq(a,b)		((a)==(b))
#define luai_numlt(a,b)		((a)<(b))
#define luai_numle(a,b)		((a)<=(b))
#define luai_numisnan(a)	(!luai_numeq((a), (a)))
#define lua_number2int(i,d)	((i)=(int)(d))
#define lua_number2integer(i,d)	((i)=(lua_Integer)(d))

On 19 Feb 2008 11:09:01 -0500, John D. Ramsdell <ramsdell@mitre.org> wrote:
> For Lua 5.2, please consider adding compile time support for hardware
> without floating point instructions.  The patch to enable this support
> is in the "Go Long Lua!" section in
>
> http://lua-users.org/wiki/LuaPowerPatches
>
> I tested the patch under 5.1.3, and all is well.
>
> An example of hardware without floating point instructions comes from
> Xen.  It provides a very lightweight virtual machine via Mini-OS.
> This 32-bit operating system does not save and restore floating point
> registers during a context switch, so you cannot use floating point
> operations.
>
> John
>