Skip to content

Commit

Permalink
Fix evaluator for Minus operator (#2360)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese authored Jan 18, 2025
1 parent 524e08d commit f140699
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions executor-utils/src/expression_evaluator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use core::ops::{Add, Mul, Sub};
use itertools::Itertools;
use std::collections::BTreeMap;
use std::ops::Neg;

use powdr_ast::analyzed::{
AlgebraicBinaryOperation, AlgebraicBinaryOperator, AlgebraicExpression as Expression,
Expand Down Expand Up @@ -147,7 +148,7 @@ where
impl<'a, T, Expr, TA> ExpressionEvaluator<'a, T, Expr, TA>
where
TA: TerminalAccess<Expr>,
Expr: Clone + Add<Output = Expr> + Sub<Output = Expr> + Mul<Output = Expr>,
Expr: Clone + Add<Output = Expr> + Sub<Output = Expr> + Mul<Output = Expr> + Neg<Output = Expr>,
T: FieldElement,
{
/// Create a new expression evaluator with custom expression converters.
Expand Down Expand Up @@ -199,7 +200,7 @@ where
},
},
Expression::UnaryOperation(AlgebraicUnaryOperation { op, expr }) => match op {
AlgebraicUnaryOperator::Minus => self.evaluate(expr),
AlgebraicUnaryOperator::Minus => -self.evaluate(expr),
},
Expression::Challenge(challenge) => self.terminal_access.get_challenge(challenge),
}
Expand Down

0 comments on commit f140699

Please sign in to comment.