[poincare/multiplication] Do not expand Multiplication in presence of units

This commit is contained in:
Ruben Dashyan
2020-03-25 15:38:43 +01:00
committed by Émilie Feral
parent bf9653d510
commit 7ef28a93bc

View File

@@ -711,6 +711,8 @@ Expression Multiplication::privateShallowReduce(ExpressionNode::ReductionContext
{
const Expression c = childAtIndex(0);
if (hasUnit()) {
// Do not expand Multiplication in presence of units
shouldExpand = false;
// Make sure a Multiplication is not made of (Power of) Units only
if (!c.isNumber()) {
addChildAtIndexInPlace(Rational::Builder(1), 0, numberOfChildren());