From 181a837cac39fe9a411b64d67239d98785518c33 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Tue, 29 Jan 2013 14:00:40 -0200 Subject: small improvement in the support of 'float' as lua_Number --- luaconf.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'luaconf.h') diff --git a/luaconf.h b/luaconf.h index d6f58ab2..ebe038ce 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.173 2012/07/13 14:54:14 roberto Exp roberto $ +** $Id: luaconf.h,v 1.174 2012/10/01 14:14:45 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -405,6 +405,12 @@ #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +/* +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations +*/ +#define l_mathop(x) (x) + + /* @@ lua_str2number converts a decimal numeric string to a number. @@ lua_strx2number converts an hexadecimal numeric string to a number. @@ -427,8 +433,8 @@ /* the following operations need the math library */ #if defined(lobject_c) || defined(lvm_c) #include <math.h> -#define luai_nummod(L,a,b) ((a) - floor((a)/(b))*(b)) -#define luai_numpow(L,a,b) (pow(a,b)) +#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) +#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) #endif /* these are quite standard operations */ -- cgit v1.2.3-55-g6feb