Make modulo arithmetic conform to lua rules for negative values.

This commit is contained in:
James Roseborough
2007-08-01 04:57:12 +00:00
parent 737c5e2855
commit 32dcbaca3a
2 changed files with 3 additions and 2 deletions

View File

@@ -39,7 +39,8 @@ public class LDouble extends LNumber {
case Lua.OP_SUB: return new LDouble( lhs - rhs );
case Lua.OP_MUL: return new LDouble( lhs * rhs );
case Lua.OP_DIV: return new LDouble( lhs / rhs );
case Lua.OP_MOD: return new LDouble( lhs % rhs );
case Lua.OP_MOD: return new LDouble( lhs - Math.floor(lhs/rhs) * rhs );
// case Lua.OP_POW: return new LDouble( Math.pow(lhs, rhs) );
}
return luaUnsupportedOperation();