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

@@ -34,7 +34,7 @@ public class LInteger extends LNumber {
case Lua.OP_SUB: return new LInteger( m_value - rhs );
case Lua.OP_MUL: return new LInteger( m_value * rhs );
case Lua.OP_DIV: return new LInteger( m_value / rhs );
case Lua.OP_MOD: return new LInteger( m_value % rhs );
case Lua.OP_MOD: return new LInteger( m_value - ((int) Math.floor(m_value/(double)rhs)) * rhs );
// case Lua.OP_POW: return new LInteger( (int) Math.pow(m_value, rhs) );
}
return luaUnsupportedOperation();