[poincare/multiplication] Factoring undef power

When factoring 1^inf * 1^-inf with Multiplication::factorizeBase, an
Undef factor would appear an be carried into the reduced multiplication.
We escape early in this situation by returning Undef.

Change-Id: Id826ad3cc131349e5bb460f7a8c82fe606294b97
This commit is contained in:
Gabriel Ozouf
2020-08-31 11:43:42 +02:00
committed by Émilie Feral
parent 59d5adace3
commit d6c7b2b1ac

View File

@@ -731,6 +731,11 @@ Expression Multiplication::privateShallowReduce(ExpressionNode::ReductionContext
}
if (shouldFactorizeBase) {
factorizeBase(i, i+1, reductionContext);
/* An undef term could have appeared when factorizing 1^inf and 1^-inf
* for instance. In that case, we escape and return undef. */
if (childAtIndex(i).isUndefined()) {
return replaceWithUndefinedInPlace();
}
continue;
}
} else if (TermHasNumeralBase(oi) && TermHasNumeralBase(oi1) && TermsHaveIdenticalExponent(oi, oi1)) {