summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lmathlib.c
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2016-12-27 00:46:46 +0300
committeraunsane <aunsane@gmail.com>2016-12-27 00:47:12 +0300
commit4f5ab8c9b5866c4445d8f37f608244ea9bf4494f (patch)
tree2e1e5a3dee91e0c8f9aed1cdc8f2465d9e1b3d35 /libs/liblua/src/lmathlib.c
parentab80b3e01ac99d5f31e2de10bf8299579afa87b4 (diff)
Updated lua lib to 5.3.4
Diffstat (limited to 'libs/liblua/src/lmathlib.c')
-rw-r--r--libs/liblua/src/lmathlib.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libs/liblua/src/lmathlib.c b/libs/liblua/src/lmathlib.c
index 94815f129f..e0240c9b54 100644
--- a/libs/liblua/src/lmathlib.c
+++ b/libs/liblua/src/lmathlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmathlib.c,v 1.117 2015/10/02 15:39:23 roberto Exp $
+** $Id: lmathlib.c,v 1.118 2016/12/20 18:37:00 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@@ -184,10 +184,13 @@ static int math_log (lua_State *L) {
else {
lua_Number base = luaL_checknumber(L, 2);
#if !defined(LUA_USE_C89)
- if (base == 2.0) res = l_mathop(log2)(x); else
+ if (base == l_mathop(2.0))
+ res = l_mathop(log2)(x); else
#endif
- if (base == 10.0) res = l_mathop(log10)(x);
- else res = l_mathop(log)(x)/l_mathop(log)(base);
+ if (base == l_mathop(10.0))
+ res = l_mathop(log10)(x);
+ else
+ res = l_mathop(log)(x)/l_mathop(log)(base);
}
lua_pushnumber(L, res);
return 1;
@@ -262,7 +265,7 @@ static int math_random (lua_State *L) {
default: return luaL_error(L, "wrong number of arguments");
}
/* random integer in the interval [low, up] */
- luaL_argcheck(L, low <= up, 1, "interval is empty");
+ luaL_argcheck(L, low <= up, 1, "interval is empty");
luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1,
"interval too large");
r *= (double)(up - low) + 1.0;
@@ -281,9 +284,9 @@ static int math_randomseed (lua_State *L) {
static int math_type (lua_State *L) {
if (lua_type(L, 1) == LUA_TNUMBER) {
if (lua_isinteger(L, 1))
- lua_pushliteral(L, "integer");
+ lua_pushliteral(L, "integer");
else
- lua_pushliteral(L, "float");
+ lua_pushliteral(L, "float");
}
else {
luaL_checkany(L, 1);