aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lmathlib.c')
-rw-r--r--lmathlib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 8c9627c2..4cf90ce4 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.116 2015/06/26 19:30:32 roberto Exp $ 2** $Id: lmathlib.c,v 1.117 2015/10/02 15:39:23 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*/
@@ -184,10 +184,13 @@ static int math_log (lua_State *L) {
184 else { 184 else {
185 lua_Number base = luaL_checknumber(L, 2); 185 lua_Number base = luaL_checknumber(L, 2);
186#if !defined(LUA_USE_C89) 186#if !defined(LUA_USE_C89)
187 if (base == 2.0) res = l_mathop(log2)(x); else 187 if (base == l_mathop(2.0))
188 res = l_mathop(log2)(x); else
188#endif 189#endif
189 if (base == 10.0) res = l_mathop(log10)(x); 190 if (base == l_mathop(10.0))
190 else res = l_mathop(log)(x)/l_mathop(log)(base); 191 res = l_mathop(log10)(x);
192 else
193 res = l_mathop(log)(x)/l_mathop(log)(base);
191 } 194 }
192 lua_pushnumber(L, res); 195 lua_pushnumber(L, res);
193 return 1; 196 return 1;