diff --git a/interpreter/src/ir.rs b/interpreter/src/ir.rs index 34df616..3ab88bd 100644 --- a/interpreter/src/ir.rs +++ b/interpreter/src/ir.rs @@ -320,7 +320,6 @@ impl Display for Instruction { | OpCode::Negation | OpCode::ToInt | OpCode::Negative - | OpCode::Concat | OpCode::Copy) => { let (dest, data) = unsafe { &self.args.unary_local }; write!(f, "{dest} <- {op} {data}") @@ -340,6 +339,7 @@ impl Display for Instruction { | OpCode::Multiply | OpCode::Divide | OpCode::Raise + | OpCode::Concat | OpCode::Modulo) => { let (dest, lhs, rhs) = unsafe { &self.args.binary_local }; write!(f, "{dest} <- {op} {lhs}, {rhs}") diff --git a/interpreter/src/vm.rs b/interpreter/src/vm.rs index 818ccca..ce576f4 100644 --- a/interpreter/src/vm.rs +++ b/interpreter/src/vm.rs @@ -117,7 +117,7 @@ impl Interpreter<'_> { let src = self.registers.get(src); let val = match ix.opcode { OpCode::Record => todo!(), - OpCode::Negation => Value::Float(!src.to_bool() as usize as f64), + OpCode::Negation => Value::b2f(!src.to_bool()), OpCode::ToInt => Value::Float(src.to_num()), OpCode::Negative => Value::Float(-src.to_num()), _ => unreachable!(),