Skip to content

Commit

Permalink
Fix operation counting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
benruijl committed Aug 14, 2024
1 parent 4186935 commit 08b6a4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3185,7 +3185,7 @@ impl<T: Clone + Default + std::fmt::Debug + Eq + std::hash::Hash + Ord> Expressi
}
Expression::Pow(p) => {
let (a, m) = p.0.count_operations();
(a, m + p.1 as usize - 1)
(a, m + p.1.unsigned_abs() as usize - 1)
}
Expression::Powf(p) => {
let (a, m) = p.0.count_operations();
Expand Down Expand Up @@ -3253,7 +3253,7 @@ impl<T: Clone + Default + std::fmt::Debug + Eq + std::hash::Hash + Ord> Expressi
}
Expression::Pow(p) => {
let (a, m) = p.0.count_operations_with_subexpression(sub_expr);
(a, m + p.1 as usize - 1)
(a, m + p.1.unsigned_abs() as usize - 1)
}
Expression::Powf(p) => {
let (a, m) = p.0.count_operations_with_subexpression(sub_expr);
Expand Down

0 comments on commit 08b6a4d

Please sign in to comment.