From 0ec2c47d9fe37a8e72007faf7023c02103e93fe7 Mon Sep 17 00:00:00 2001 From: fintarin Date: Tue, 11 Jul 2023 23:07:15 +0300 Subject: [PATCH] Implement the negation of DivExpression --- src/fintamath/expressions/unary/NegExpression.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fintamath/expressions/unary/NegExpression.cpp b/src/fintamath/expressions/unary/NegExpression.cpp index 218d0351f..17fc6bdb6 100644 --- a/src/fintamath/expressions/unary/NegExpression.cpp +++ b/src/fintamath/expressions/unary/NegExpression.cpp @@ -57,6 +57,11 @@ ArgumentPtr NegExpression::simplifyNegatable(const IFunction & /*func*/, const A rhsChildren.emplace_back(std::make_shared(-1)); res = makeExpr(Mul(), rhsChildren); } + else if (is
(rhsExpr->getFunction())) { + ArgumentPtr divLhs = makeExpr(Neg(), rhsChildren.front()); + ArgumentPtr divRhs = rhsChildren.back(); + res = makeExpr(Div(), divLhs, divRhs); + } else if (is(rhsExpr->getFunction())) { ArgumentPtr logLhs = rhsChildren.front(); ArgumentPtr logRhs = makeExpr(Div(), std::make_shared(1), rhsChildren.back());