mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 09:10:48 +01:00
[poincare] TurnIntoPositive returns a simplified expression
Change-Id: Ia5c01e7cc1e8f1be4f26ad477c55c4e291aad789
This commit is contained in:
@@ -42,6 +42,7 @@ void Multiplication::turnIntoPositive() {
|
||||
const_cast<Expression *>(operand(i))->turnIntoPositive();
|
||||
}
|
||||
}
|
||||
immediateSimplify();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -305,7 +306,6 @@ Expression * Multiplication::mergeNegativePower() {
|
||||
if (operand(i)->type() == Type::Power && operand(i)->operand(1)->sign() < 0) {
|
||||
const Expression * e = operand(i);
|
||||
const_cast<Expression *>(e->operand(1))->turnIntoPositive();
|
||||
// TODO: should we call const_cast<Expression *>(e->operand(1))->immediateSimplify
|
||||
removeOperand(e, false);
|
||||
m->addOperands(&e, 1);
|
||||
const_cast<Expression *>(e)->immediateSimplify();
|
||||
|
||||
@@ -363,8 +363,6 @@ Expression * Power::createDenominator() {
|
||||
if (operand(1)->sign() < 0) {
|
||||
Expression * denominator = clone();
|
||||
const_cast<Expression *>(denominator->operand(1))->turnIntoPositive();
|
||||
|
||||
const_cast<Expression *>(denominator->operand(1))->simplify();
|
||||
if (denominator->operand(1)->type() == Type::Rational && static_cast<Rational *>((Expression *)denominator->operand(1))->isOne()) {
|
||||
delete denominator;
|
||||
return operand(0)->clone();
|
||||
|
||||
Reference in New Issue
Block a user