[poincare] Change name of static mathod in multiplication and add

comment

Change-Id: I0f6843c9d71b4628837c8b8958a09c0c3428eaa6
This commit is contained in:
Émilie Feral
2017-11-08 13:11:20 +01:00
parent ddb3a62aba
commit 97b22cbe33
2 changed files with 5 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ private:
void addMissingFactors(Expression * factor, Context & context, AngleUnit angleUnit);
static bool HaveSameNonRationalFactors(const Expression * e1, const Expression * e2);
static bool TermsHaveIdenticalBase(const Expression * e1, const Expression * e2);
static bool TermsHaveIdenticalNonUnitaryExponent(const Expression * e1, const Expression * e2);
static bool TermsHaveIdenticalExponent(const Expression * e1, const Expression * e2);
static bool TermHasRationalBase(const Expression * e);
static bool TermHasIntegerExponent(const Expression * e);
static const Expression * CreateExponent(Expression * e);

View File

@@ -141,7 +141,7 @@ Expression * Multiplication::shallowReduce(Context& context, AngleUnit angleUnit
} else if (TermsHaveIdenticalBase(operand(i), operand(i+1)) && (!TermHasRationalBase(operand(i)) || (!TermHasIntegerExponent(operand(i)) && !TermHasIntegerExponent(operand(i+1))))) {
factorizeBase(editableOperand(i), editableOperand(i+1), context, angleUnit);
continue;
} else if (TermsHaveIdenticalNonUnitaryExponent(operand(i), operand(i+1)) && TermHasRationalBase(operand(i)) && TermHasRationalBase(operand(i+1))) {
} else if (TermsHaveIdenticalExponent(operand(i), operand(i+1)) && TermHasRationalBase(operand(i)) && TermHasRationalBase(operand(i+1))) {
factorizeExponent(editableOperand(i), editableOperand(i+1), context, angleUnit);
continue;
}
@@ -300,7 +300,9 @@ bool Multiplication::TermsHaveIdenticalBase(const Expression * e1, const Express
return f1->isIdenticalTo(f2);
}
bool Multiplication::TermsHaveIdenticalNonUnitaryExponent(const Expression * e1, const Expression * e2) {
bool Multiplication::TermsHaveIdenticalExponent(const Expression * e1, const Expression * e2) {
/* Note: We will return false for e1=2 and e2=Pi, even though one could argue
* that these have the same exponent whose value is 1. */
return e1->type() == Type::Power && e2->type() == Type::Power && (e1->operand(1)->isIdenticalTo(e2->operand(1)));
}