diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-24 12:01:42 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-24 12:09:49 +0200 |
commit | 656758c86ad929b07bb6422eb0f44cf9f2347aac (patch) | |
tree | 9463a52cfa7e49245054577804f1bd6dcaf22ff8 /src/lmathlib.js | |
parent | d15e00af0798783bdce5e27d2ab43de3ecb3fa4e (diff) | |
download | fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.gz fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.bz2 fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.zip |
Use maximum 32bit number instead of Number.MAX_SAFE_INTEGER
Diffstat (limited to 'src/lmathlib.js')
-rw-r--r-- | src/lmathlib.js | 6 |
1 files changed, 3 insertions, 3 deletions
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; }; |