diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 66e82cc6e..16c56fe7f 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -636,6 +636,14 @@ void Expression::beautifyAndApproximateScalar(Expression * simplifiedExpression, *simplifiedExpression = deepBeautify(userReductionContext); // Step 2: approximation if (approximateExpression) { + if (simplifiedExpression->recursivelyMatches([](const Expression e, Context * context) { return e.type() == ExpressionNode::Type::Unit; }, nullptr, false)) { + /* Approximate and simplified expressions are set equal so that only + * one of them will be output. Note that there is no need to clone + * since the expressions will not be altered. */ + *approximateExpression = *simplifiedExpression; + return; + } + *approximateExpression = simplifiedExpression->approximate(context, complexFormat, angleUnit); } }