diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index 001780b64..d1a887c03 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -392,6 +392,7 @@ private: } void defaultDeepReduceChildren(ExpressionNode::ReductionContext reductionContext); Expression defaultShallowReduce(); + Expression defaultHandleUnitsInChildren(); // Children must be reduced Expression shallowReduceUsingApproximation(ExpressionNode::ReductionContext reductionContext); Expression defaultShallowBeautify() { return *this; } diff --git a/poincare/src/absolute_value.cpp b/poincare/src/absolute_value.cpp index 6f0de1535..18bbafe14 100644 --- a/poincare/src/absolute_value.cpp +++ b/poincare/src/absolute_value.cpp @@ -37,6 +37,7 @@ Expression AbsoluteValueNode::shallowReduce(ReductionContext reductionContext) { Expression AbsoluteValue::shallowReduce(ExpressionNode::ReductionContext reductionContext) { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/arc_cosine.cpp b/poincare/src/arc_cosine.cpp index 6c0c75d65..353c4b974 100644 --- a/poincare/src/arc_cosine.cpp +++ b/poincare/src/arc_cosine.cpp @@ -52,6 +52,7 @@ Complex ArcCosineNode::computeOnComplex(const std::complex c, Preferences: Expression ArcCosine::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/arc_sine.cpp b/poincare/src/arc_sine.cpp index f6e3195cc..2ee8b0fd1 100644 --- a/poincare/src/arc_sine.cpp +++ b/poincare/src/arc_sine.cpp @@ -52,6 +52,7 @@ Complex ArcSineNode::computeOnComplex(const std::complex c, Preferences::C Expression ArcSine::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/arc_tangent.cpp b/poincare/src/arc_tangent.cpp index facefcddb..2f8152411 100644 --- a/poincare/src/arc_tangent.cpp +++ b/poincare/src/arc_tangent.cpp @@ -51,6 +51,7 @@ Expression ArcTangentNode::shallowReduce(ReductionContext reductionContext) { Expression ArcTangent::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/binomial_coefficient.cpp b/poincare/src/binomial_coefficient.cpp index 3d5468bee..248c91ce3 100644 --- a/poincare/src/binomial_coefficient.cpp +++ b/poincare/src/binomial_coefficient.cpp @@ -58,6 +58,7 @@ T BinomialCoefficientNode::compute(T k, T n) { Expression BinomialCoefficient::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/binomial_distribution_function.cpp b/poincare/src/binomial_distribution_function.cpp index 2dcd2b96e..fe3495a8f 100644 --- a/poincare/src/binomial_distribution_function.cpp +++ b/poincare/src/binomial_distribution_function.cpp @@ -14,6 +14,7 @@ Expression BinomialDistributionFunction::shallowReduce(Context * context, bool * } { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/ceiling.cpp b/poincare/src/ceiling.cpp index 9700df2fb..7479f20fe 100644 --- a/poincare/src/ceiling.cpp +++ b/poincare/src/ceiling.cpp @@ -39,6 +39,7 @@ Expression CeilingNode::shallowReduce(ReductionContext reductionContext) { Expression Ceiling::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/complex_argument.cpp b/poincare/src/complex_argument.cpp index 863049a23..9e1ef1bf8 100644 --- a/poincare/src/complex_argument.cpp +++ b/poincare/src/complex_argument.cpp @@ -37,6 +37,7 @@ Complex ComplexArgumentNode::computeOnComplex(const std::complex c, Prefer Expression ComplexArgument::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/complex_cartesian.cpp b/poincare/src/complex_cartesian.cpp index 006a1b700..5be1ff6b9 100644 --- a/poincare/src/complex_cartesian.cpp +++ b/poincare/src/complex_cartesian.cpp @@ -55,6 +55,7 @@ Complex ComplexCartesianNode::templatedApproximate(Context * context, Prefere Expression ComplexCartesian::shallowReduce() { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/confidence_interval.cpp b/poincare/src/confidence_interval.cpp index 9e30edde7..112e129c2 100644 --- a/poincare/src/confidence_interval.cpp +++ b/poincare/src/confidence_interval.cpp @@ -56,6 +56,7 @@ int SimplePredictionIntervalNode::serialize(char * buffer, int bufferSize, Prefe Expression ConfidenceInterval::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/conjugate.cpp b/poincare/src/conjugate.cpp index bdcaaaba2..3c3683cf2 100644 --- a/poincare/src/conjugate.cpp +++ b/poincare/src/conjugate.cpp @@ -35,6 +35,7 @@ Complex ConjugateNode::computeOnComplex(const std::complex c, Preferences: Expression Conjugate::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/cosine.cpp b/poincare/src/cosine.cpp index 4b92d0529..12580df9d 100644 --- a/poincare/src/cosine.cpp +++ b/poincare/src/cosine.cpp @@ -37,6 +37,7 @@ Expression CosineNode::shallowReduce(ReductionContext reductionContext) { Expression Cosine::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/derivative.cpp b/poincare/src/derivative.cpp index 74fe60cb4..0065f79dc 100644 --- a/poincare/src/derivative.cpp +++ b/poincare/src/derivative.cpp @@ -154,6 +154,7 @@ T DerivativeNode::riddersApproximation(Context * context, Preferences::ComplexFo Expression Derivative::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/determinant.cpp b/poincare/src/determinant.cpp index 3c947cb43..900cdcaca 100644 --- a/poincare/src/determinant.cpp +++ b/poincare/src/determinant.cpp @@ -38,6 +38,7 @@ Expression DeterminantNode::shallowReduce(ReductionContext reductionContext) { Expression Determinant::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/division_quotient.cpp b/poincare/src/division_quotient.cpp index 99b141ad4..5c5768142 100644 --- a/poincare/src/division_quotient.cpp +++ b/poincare/src/division_quotient.cpp @@ -39,6 +39,7 @@ Evaluation DivisionQuotientNode::templatedApproximate(Context * context, Pref Expression DivisionQuotient::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/division_remainder.cpp b/poincare/src/division_remainder.cpp index 457d1b163..4efc984c1 100644 --- a/poincare/src/division_remainder.cpp +++ b/poincare/src/division_remainder.cpp @@ -40,6 +40,7 @@ Evaluation DivisionRemainderNode::templatedApproximate(Context * context, Pre Expression DivisionRemainder::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 95013be9b..3f06e7d25 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -342,6 +342,17 @@ Expression Expression::defaultShallowReduce() { return *this; } +Expression Expression::defaultHandleUnitsInChildren() { + // Generically, an Expression does not accept any Unit in its children. + const int childrenCount = numberOfChildren(); + for (int i = 0; i < childrenCount; i++) { + if (childAtIndex(i).hasUnit()) { + return replaceWithUndefinedInPlace(); + } + } + return *this; +} + Expression Expression::shallowReduceUsingApproximation(ExpressionNode::ReductionContext reductionContext) { double approx = node()->approximate(double(), reductionContext.context(), reductionContext.complexFormat(), reductionContext.angleUnit()).toScalar(); /* If approx is capped by the largest integer such as all smaller integers can diff --git a/poincare/src/factor.cpp b/poincare/src/factor.cpp index 3e0297c12..1a055457e 100644 --- a/poincare/src/factor.cpp +++ b/poincare/src/factor.cpp @@ -74,6 +74,7 @@ Multiplication Factor::createMultiplicationOfIntegerPrimeDecomposition(Integer i Expression Factor::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/factorial.cpp b/poincare/src/factorial.cpp index 84d97ad9e..7956f2086 100644 --- a/poincare/src/factorial.cpp +++ b/poincare/src/factorial.cpp @@ -87,6 +87,7 @@ int FactorialNode::serialize(char * buffer, int bufferSize, Preferences::PrintFl Expression Factorial::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/floor.cpp b/poincare/src/floor.cpp index f195e82c3..519bc9275 100644 --- a/poincare/src/floor.cpp +++ b/poincare/src/floor.cpp @@ -38,6 +38,7 @@ Expression FloorNode::shallowReduce(ReductionContext reductionContext) { Expression Floor::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/frac_part.cpp b/poincare/src/frac_part.cpp index 0b903399b..d1ecf4f4e 100644 --- a/poincare/src/frac_part.cpp +++ b/poincare/src/frac_part.cpp @@ -35,6 +35,7 @@ Complex FracPartNode::computeOnComplex(const std::complex c, Preferences:: Expression FracPart::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/great_common_divisor.cpp b/poincare/src/great_common_divisor.cpp index ec0c7a31b..db7bb6c10 100644 --- a/poincare/src/great_common_divisor.cpp +++ b/poincare/src/great_common_divisor.cpp @@ -52,6 +52,7 @@ Evaluation GreatCommonDivisorNode::templatedApproximate(Context * context, Pr Expression GreatCommonDivisor::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/hyperbolic_trigonometric_function.cpp b/poincare/src/hyperbolic_trigonometric_function.cpp index adcb252ff..ea4222d70 100644 --- a/poincare/src/hyperbolic_trigonometric_function.cpp +++ b/poincare/src/hyperbolic_trigonometric_function.cpp @@ -11,6 +11,7 @@ Expression HyperbolicTrigonometricFunctionNode::shallowReduce(ReductionContext r Expression HyperbolicTrigonometricFunction::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/imaginary_part.cpp b/poincare/src/imaginary_part.cpp index 5dd188b58..ff3bc76cf 100644 --- a/poincare/src/imaginary_part.cpp +++ b/poincare/src/imaginary_part.cpp @@ -27,6 +27,7 @@ Expression ImaginaryPartNode::shallowReduce(ReductionContext reductionContext) { Expression ImaginaryPart::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/integral.cpp b/poincare/src/integral.cpp index fa9ce0ff9..a74ab5646 100644 --- a/poincare/src/integral.cpp +++ b/poincare/src/integral.cpp @@ -216,6 +216,7 @@ Expression Integral::UntypedBuilder(Expression children) { Expression Integral::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/least_common_multiple.cpp b/poincare/src/least_common_multiple.cpp index e9828820a..9e446ed35 100644 --- a/poincare/src/least_common_multiple.cpp +++ b/poincare/src/least_common_multiple.cpp @@ -56,6 +56,7 @@ Evaluation LeastCommonMultipleNode::templatedApproximate(Context * context, P Expression LeastCommonMultiple::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/logarithm.cpp b/poincare/src/logarithm.cpp index 027c5ce80..0c7e5c1e3 100644 --- a/poincare/src/logarithm.cpp +++ b/poincare/src/logarithm.cpp @@ -107,6 +107,7 @@ void Logarithm::deepReduceChildren(ExpressionNode::ReductionContext reductionCon Expression CommonLogarithm::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } @@ -123,6 +124,7 @@ Expression CommonLogarithm::shallowReduce(ExpressionNode::ReductionContext reduc Expression Logarithm::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/matrix_dimension.cpp b/poincare/src/matrix_dimension.cpp index 6815b43d7..ffd5a2738 100644 --- a/poincare/src/matrix_dimension.cpp +++ b/poincare/src/matrix_dimension.cpp @@ -43,6 +43,7 @@ Evaluation MatrixDimensionNode::templatedApproximate(Context * context, Prefe Expression MatrixDimension::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/matrix_identity.cpp b/poincare/src/matrix_identity.cpp index d37f40eaf..6357e97ed 100644 --- a/poincare/src/matrix_identity.cpp +++ b/poincare/src/matrix_identity.cpp @@ -44,6 +44,7 @@ Evaluation MatrixIdentityNode::templatedApproximate(Context * context, Prefer Expression MatrixIdentity::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/matrix_inverse.cpp b/poincare/src/matrix_inverse.cpp index 506fea1bb..e336b0c67 100644 --- a/poincare/src/matrix_inverse.cpp +++ b/poincare/src/matrix_inverse.cpp @@ -45,6 +45,7 @@ Evaluation MatrixInverseNode::templatedApproximate(Context * context, Prefere Expression MatrixInverse::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/matrix_trace.cpp b/poincare/src/matrix_trace.cpp index 80c99203f..4413bcdfb 100644 --- a/poincare/src/matrix_trace.cpp +++ b/poincare/src/matrix_trace.cpp @@ -37,6 +37,7 @@ Evaluation MatrixTraceNode::templatedApproximate(Context * context, Preferenc Expression MatrixTrace::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/matrix_transpose.cpp b/poincare/src/matrix_transpose.cpp index c0b22b2f8..f64fe136b 100644 --- a/poincare/src/matrix_transpose.cpp +++ b/poincare/src/matrix_transpose.cpp @@ -41,6 +41,7 @@ Evaluation MatrixTransposeNode::templatedApproximate(Context * context, Prefe Expression MatrixTranspose::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/naperian_logarithm.cpp b/poincare/src/naperian_logarithm.cpp index f62bd31b7..904f59e52 100644 --- a/poincare/src/naperian_logarithm.cpp +++ b/poincare/src/naperian_logarithm.cpp @@ -26,6 +26,7 @@ Expression NaperianLogarithmNode::shallowReduce(ReductionContext reductionContex Expression NaperianLogarithm::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/normal_distribution_function.cpp b/poincare/src/normal_distribution_function.cpp index 898023283..71a255cdf 100644 --- a/poincare/src/normal_distribution_function.cpp +++ b/poincare/src/normal_distribution_function.cpp @@ -15,6 +15,7 @@ Expression NormalDistributionFunction::shallowReduce(Context * context, bool * s } { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/permute_coefficient.cpp b/poincare/src/permute_coefficient.cpp index e26b39730..d7bc77190 100644 --- a/poincare/src/permute_coefficient.cpp +++ b/poincare/src/permute_coefficient.cpp @@ -53,6 +53,7 @@ Evaluation PermuteCoefficientNode::templatedApproximate(Context * context, Pr Expression PermuteCoefficient::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/prediction_interval.cpp b/poincare/src/prediction_interval.cpp index 16501cf44..d01d0acdc 100644 --- a/poincare/src/prediction_interval.cpp +++ b/poincare/src/prediction_interval.cpp @@ -49,6 +49,7 @@ Evaluation PredictionIntervalNode::templatedApproximate(Context * context, Pr Expression PredictionInterval::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/randint.cpp b/poincare/src/randint.cpp index 498982d89..2b95ff092 100644 --- a/poincare/src/randint.cpp +++ b/poincare/src/randint.cpp @@ -62,6 +62,7 @@ Expression RandintNode::shallowReduce(ReductionContext reductionContext) { Expression Randint::shallowReduce(ExpressionNode::ReductionContext reductionContext) { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/real_part.cpp b/poincare/src/real_part.cpp index 60ccf90c4..ee58e276f 100644 --- a/poincare/src/real_part.cpp +++ b/poincare/src/real_part.cpp @@ -27,6 +27,7 @@ Expression RealPartNode::shallowReduce(ReductionContext reductionContext) { Expression RealPart::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/round.cpp b/poincare/src/round.cpp index 92bd9c45e..0b1808be7 100644 --- a/poincare/src/round.cpp +++ b/poincare/src/round.cpp @@ -42,6 +42,7 @@ Evaluation RoundNode::templatedApproximate(Context * context, Preferences::Co Expression Round::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/sequence.cpp b/poincare/src/sequence.cpp index 224d93393..5b8bc624f 100644 --- a/poincare/src/sequence.cpp +++ b/poincare/src/sequence.cpp @@ -50,6 +50,7 @@ Evaluation SequenceNode::templatedApproximate(Context * context, Preferences: Expression Sequence::shallowReduce(Context * context) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/sign_function.cpp b/poincare/src/sign_function.cpp index 285cd5cb7..ba4765413 100644 --- a/poincare/src/sign_function.cpp +++ b/poincare/src/sign_function.cpp @@ -57,6 +57,7 @@ Complex SignFunctionNode::computeOnComplex(const std::complex c, Preferenc Expression SignFunction::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e = e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/sine.cpp b/poincare/src/sine.cpp index dd2dd22d3..5e4c6d157 100644 --- a/poincare/src/sine.cpp +++ b/poincare/src/sine.cpp @@ -38,6 +38,7 @@ Expression SineNode::shallowReduce(ReductionContext reductionContext) { Expression Sine::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/square_root.cpp b/poincare/src/square_root.cpp index 526997df0..a46698cdd 100644 --- a/poincare/src/square_root.cpp +++ b/poincare/src/square_root.cpp @@ -46,6 +46,7 @@ Expression SquareRootNode::shallowReduce(ReductionContext reductionContext) { Expression SquareRoot::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; } diff --git a/poincare/src/tangent.cpp b/poincare/src/tangent.cpp index 66c03d9a7..dab065a96 100644 --- a/poincare/src/tangent.cpp +++ b/poincare/src/tangent.cpp @@ -41,6 +41,7 @@ Expression TangentNode::shallowReduce(ReductionContext reductionContext) { Expression Tangent::shallowReduce(ExpressionNode::ReductionContext reductionContext) { { Expression e = Expression::defaultShallowReduce(); + e.defaultHandleUnitsInChildren(); if (e.isUndefined()) { return e; }