mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Calculation: avoid 1/400000 = 0.000003
Re-serialise the calculation approximate output with the right number of significant digits before comparing the parsed expression with the exact one
This commit is contained in:
committed by
EmilieNumworks
parent
03c8b373f7
commit
ed59909531
@@ -196,7 +196,10 @@ bool Calculation::exactAndApproximateOutputsAreEqual(Poincare::Context * context
|
||||
if (exactOutput(context)->type() != Expression::Type::Rational) {
|
||||
return false;
|
||||
}
|
||||
Expression * approximateOutput = Expression::ParseAndSimplify(m_approximateOutputText, *context);
|
||||
assert(approximateOutput(context)->type() == Type::Complex);
|
||||
char buffer[k_printedExpressionSize];
|
||||
Complex<double>::convertFloatToText(static_cast<Complex<double> *>(approximateOutput(context))->a(), buffer, k_printedExpressionSize, Preferences::sharedPreferences()->numberOfSignificantDigits(), Preferences::sharedPreferences()->displayMode());
|
||||
Expression * approximateOutput = Expression::ParseAndSimplify(buffer, *context);
|
||||
bool isEqual = approximateOutput->isIdenticalTo(exactOutput(context));
|
||||
delete approximateOutput;
|
||||
return isEqual;
|
||||
|
||||
Reference in New Issue
Block a user