aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lmathlib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 4eeaae9e..cc397fc2 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.84 2013/05/02 17:31:54 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.85 2013/05/06 17:22:55 roberto Exp $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,6 +22,11 @@
22#define RADIANS_PER_DEGREE ((lua_Number)(PI/180.0)) 22#define RADIANS_PER_DEGREE ((lua_Number)(PI/180.0))
23 23
24 24
25/* types for lua_Number pointers subject to 'l_mathop' changes */
26typedef float l_pnumf;
27typedef double l_pnum;
28typedef long double l_pnuml;
29
25 30
26static int math_abs (lua_State *L) { 31static int math_abs (lua_State *L) {
27 lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); 32 lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1)));
@@ -96,7 +101,7 @@ static int math_fmod (lua_State *L) {
96} 101}
97 102
98static int math_modf (lua_State *L) { 103static int math_modf (lua_State *L) {
99 lua_Number ip; 104 l_mathop(l_pnum) ip;
100 lua_Number fp = l_mathop(modf)(luaL_checknumber(L, 1), &ip); 105 lua_Number fp = l_mathop(modf)(luaL_checknumber(L, 1), &ip);
101 lua_pushnumber(L, ip); 106 lua_pushnumber(L, ip);
102 lua_pushnumber(L, fp); 107 lua_pushnumber(L, fp);