From 3ac595da8a21770826894a926425d66dddd8c85e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 18 May 2012 14:47:53 -0300 Subject: [PATCH] allow "long double" precision for PI constant if needed --- lmathlib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lmathlib.c b/lmathlib.c index 035dd090..bc8df46e 100644 --- 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)));