diff options
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.13 1998/12/30 17:22:17 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.14 1998/12/30 21:23:26 roberto Exp $ |
3 | ** Lua standard mathematical library | 3 | ** Lua standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -12,15 +12,18 @@ | |||
12 | #include "lua.h" | 12 | #include "lua.h" |
13 | #include "lualib.h" | 13 | #include "lualib.h" |
14 | 14 | ||
15 | #ifdef M_PI | ||
16 | #define PI M_PI | ||
17 | #else | ||
18 | #define PI ((double)3.14159265358979323846) | ||
19 | #endif | ||
20 | 15 | ||
16 | #define PI (3.14159265358979323846) | ||
21 | 17 | ||
22 | #define FROMRAD(a) ((a)*(180.0/PI)) | 18 | |
23 | #define TORAD(a) ((a)*(PI/180.0)) | 19 | /* |
20 | ** If you want Lua to operate in radians (instead of degrees), | ||
21 | ** changes these two macros to identities: | ||
22 | ** #define FROMRAD(a) (a) | ||
23 | ** #define TORAD(a) (a) | ||
24 | */ | ||
25 | #define FROMRAD(a) ((a)*(180.0/PI)) | ||
26 | #define TORAD(a) ((a)*(PI/180.0)) | ||
24 | 27 | ||
25 | 28 | ||
26 | static void math_abs (void) | 29 | static void math_abs (void) |