diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-01-04 10:41:12 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-01-04 10:41:12 -0200 |
| commit | 827846804196b1779a61ffdc75d0aeb157f8465d (patch) | |
| tree | 7f54880a83d66cedad8cf2555144d684569f3427 /lmathlib.c | |
| parent | 4fbb2531b3e60094e760e30fffbd9c8b2d67a238 (diff) | |
| download | lua-827846804196b1779a61ffdc75d0aeb157f8465d.tar.gz lua-827846804196b1779a61ffdc75d0aeb157f8465d.tar.bz2 lua-827846804196b1779a61ffdc75d0aeb157f8465d.zip | |
comments
Diffstat (limited to '')
| -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) |
