diff options
Diffstat (limited to '')
| -rw-r--r-- | lmathlib.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.79 2010/11/18 18:38:27 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.80 2011/07/05 12:49:35 roberto Exp roberto $ |
| 3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -17,17 +17,17 @@ | |||
| 17 | #include "lualib.h" | 17 | #include "lualib.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | #undef PI | ||
| 21 | #define PI (3.14159265358979323846) | ||
| 22 | #define RADIANS_PER_DEGREE (PI/180.0) | ||
| 23 | |||
| 24 | |||
| 25 | /* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */ | 20 | /* macro 'l_tg' allows the addition of an 'l' or 'f' to all math operations */ |
| 26 | #if !defined(l_tg) | 21 | #if !defined(l_tg) |
| 27 | #define l_tg(x) (x) | 22 | #define l_tg(x) (x) |
| 28 | #endif | 23 | #endif |
| 29 | 24 | ||
| 30 | 25 | ||
| 26 | #undef PI | ||
| 27 | #define PI (l_tg(3.1415926535897932384626433832795)) | ||
| 28 | #define RADIANS_PER_DEGREE (PI/180.0) | ||
| 29 | |||
| 30 | |||
| 31 | 31 | ||
| 32 | static int math_abs (lua_State *L) { | 32 | static int math_abs (lua_State *L) { |
| 33 | lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1))); | 33 | lua_pushnumber(L, l_tg(fabs)(luaL_checknumber(L, 1))); |
