aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lobject.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 52e9712..680e293 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -523,7 +523,7 @@ const intarith = function(L, op, v1, v2) {
case defs.LUA_OPSUB: return (v1 - v2)|0;
case defs.LUA_OPMUL: return (v1 * v2)|0;
case defs.LUA_OPMOD: return (v1 - Math.floor(v1 / v2) * v2)|0; // % semantic on negative numbers is different in js
- case defs.LUA_OPIDIV: return (v1 / v2)|0;
+ case defs.LUA_OPIDIV: return Math.floor(v1 / v2)|0;
case defs.LUA_OPBAND: return (v1 & v2);
case defs.LUA_OPBOR: return (v1 | v2);
case defs.LUA_OPBXOR: return (v1 ^ v2);
@@ -543,7 +543,7 @@ const numarith = function(L, op, v1, v2) {
case defs.LUA_OPMUL: return v1 * v2;
case defs.LUA_OPDIV: return v1 / v2;
case defs.LUA_OPPOW: return Math.pow(v1, v2);
- case defs.LUA_OPIDIV: return (v1 / v2);
+ case defs.LUA_OPIDIV: return Math.floor(v1 / v2);
case defs.LUA_OPUNM: return -v1;
case defs.LUA_OPMOD: return v1 % v2;
default: assert(0);