mirror of https://github.com/lua/lua
allow "long double" precision for PI constant if needed
This commit is contained in:
parent
ea980fdeef
commit
3ac595da8a
12
lmathlib.c
12
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)));
|
||||
|
|
Loading…
Reference in New Issue