mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare/expression] Equalize simplified and approximate output in presence of units
This commit is contained in:
committed by
Léa Saviot
parent
c4f112e5aa
commit
054aac2c1c
@@ -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<double>(context, complexFormat, angleUnit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user