commit 3ac595da8a21770826894a926425d66dddd8c85e
parent ea980fdeef9859c99d69b29b26695fd619a32a33
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 18 May 2012 14:47:29 -0300
allow "long double" precision for PI constant if needed
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lmathlib.c b/lmathlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmathlib.c,v 1.79 2010/11/18 18:38:27 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.80 2011/07/05 12:49:35 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@@ -17,17 +17,17 @@
#include "lualib.h"
-#undef PI
-#define PI (3.14159265358979323846)
-#define RADIANS_PER_DEGREE (PI/180.0)
-
-
/* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */
#if !defined(l_tg)
#define l_tg(x) (x)
#endif
+#undef PI
+#define PI (l_tg(3.1415926535897932384626433832795))
+#define RADIANS_PER_DEGREE (PI/180.0)
+
+
static int math_abs (lua_State *L) {
lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1)));