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

This commit is contained in:
teoxoy
2023-10-05 03:05:52 +02:00
committed by Teodor Tanasoaia
parent a9c28d47c3
commit 13a0ed4eae

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 {