فهرست منبع

allow "long double" precision for PI constant if needed

Roberto Ierusalimschy 13 سال پیش
والد
کامیت
3ac595da8a
1فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 6 6
      lmathlib.c

+ 6 - 6
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)));