diff --git a/poincare/include/poincare/multiplication.h b/poincare/include/poincare/multiplication.h index b8e34a8c2..56bb05b88 100644 --- a/poincare/include/poincare/multiplication.h +++ b/poincare/include/poincare/multiplication.h @@ -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); diff --git a/poincare/src/multiplication.cpp b/poincare/src/multiplication.cpp index 890298e69..56cca9920 100644 --- a/poincare/src/multiplication.cpp +++ b/poincare/src/multiplication.cpp @@ -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))); }