[apps/calculation/calculation] Do not approximate approximateOutput again

This commit is contained in:
Ruben Dashyan
2020-01-21 11:46:35 +01:00
committed by Léa Saviot
parent a9ca60338c
commit c4f112e5aa

View File

@@ -61,11 +61,17 @@ Expression Calculation::exactOutput() {
}
Expression Calculation::approximateOutput(Context * context) {
/* To ensure that the expression 'm_output' is a matrix or a complex, we
* call 'evaluate'. */
Expression exp = Expression::Parse(approximateOutputText(), nullptr);
assert(!exp.isUninitialized());
return PoincareHelpers::Approximate<double>(exp, context);
/* Warning:
* Since quite old versions of Epsilon, the Expression 'exp' was used to be
* approximated again to ensure its content was in the expected form. That is
* currently the case (see Poincare::Expression::simplifyAndApproximate). So
* 'exp' does not need to be approximated. Moreover since the approximate
* output may contain units and that a Poincare::Unit approximates to undef,
* thus it must not be approximated. If another behavior is desired, the
* previous considerations should be taken into account. */
return exp;
}
Layout Calculation::createInputLayout() {