Skip to content

Commit

Permalink
Implement the negation of DivExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
fintarin committed Jul 11, 2023
1 parent 4ac66b8 commit 6553fde
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fintamath/expressions/unary/NegExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ ArgumentPtr NegExpression::simplifyNegatable(const IFunction & /*func*/, const A
rhsChildren.emplace_back(std::make_shared<Integer>(-1));
res = makeExpr(Mul(), rhsChildren);
}
else if (is<Div>(rhsExpr->getFunction())) {
ArgumentPtr divLhs = makeExpr(Neg(), rhsChildren.front());
ArgumentPtr divRhs = rhsChildren.back();
res = makeExpr(Div(), divLhs, divRhs);
}
else if (is<Log>(rhsExpr->getFunction())) {
ArgumentPtr logLhs = rhsChildren.front();
ArgumentPtr logRhs = makeExpr(Div(), std::make_shared<Integer>(1), rhsChildren.back());
Expand Down

0 comments on commit 6553fde

Please sign in to comment.