[const-eval] evaluate BinaryOperator::Modulo correctly (use the truncated version instead of floored)

This commit is contained in:
teoxoy authored and Teodor Tanasoaia committed 2023-10-12 13:13:26 +02:00
1 parent a9c28d47c3
commit 13a0ed4eae
1 file changed
+1 -1
+1 -1
View File
@@ -1027,7 +1027,7 @@ impl<'a> ConstantEvaluator<'a> {
BinaryOperator::Subtract => a - b,
BinaryOperator::Multiply => a * b,
BinaryOperator::Divide => a / b,
BinaryOperator::Modulo => a - b * (a / b).floor(),
BinaryOperator::Modulo => a % b,
_ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs),
}),
(Literal::Bool(a), Literal::Bool(b)) => Literal::Bool(match op {