From 656758c86ad929b07bb6422eb0f44cf9f2347aac Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 24 Apr 2017 12:01:42 +0200 Subject: Use maximum 32bit number instead of Number.MAX_SAFE_INTEGER --- src/lmathlib.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lmathlib.js') diff --git a/src/lmathlib.js b/src/lmathlib.js index c052fcb..fd18711 100644 --- a/src/lmathlib.js +++ b/src/lmathlib.js @@ -42,7 +42,7 @@ const math_random = function(L) { /* random integer in the interval [low, up] */ lauxlib.luaL_argcheck(L, low <= up, 1, lua.to_luastring("interval is empty", true)); - lauxlib.luaL_argcheck(L, low >= 0 || up <= Number.MAX_SAFE_INTEGER + low, 1, + lauxlib.luaL_argcheck(L, low >= 0 || up <= llimit.MAX_INT + low, 1, lua.to_luastring("interval too large", true)); r *= (up - low) + 1; @@ -268,9 +268,9 @@ const luaopen_math = function(L) { lapi.lua_setfield(L, -2, lua.to_luastring("pi", true)); lapi.lua_pushnumber(L, Number.MAX_VALUE); lapi.lua_setfield(L, -2, lua.to_luastring("huge", true)); - lapi.lua_pushinteger(L, Number.MAX_SAFE_INTEGER); + lapi.lua_pushinteger(L, llimit.MAX_INT); lapi.lua_setfield(L, -2, lua.to_luastring("maxinteger", true)); - lapi.lua_pushinteger(L, Number.MIN_SAFE_INTEGER); + lapi.lua_pushinteger(L, llimit.MIN_INT); lapi.lua_setfield(L, -2, lua.to_luastring("mininteger", true)); return 1; }; -- cgit v1.2.3-54-g00ecf