mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Calculation: add a method to test if the exact output and the
approximate output are equal
This commit is contained in:
committed by
EmilieNumworks
parent
8027da6ca2
commit
9d6b2e3cad
@@ -192,4 +192,14 @@ bool Calculation::shouldDisplayApproximateOutput(Context * context) {
|
||||
return input()->isApproximate(*context);
|
||||
}
|
||||
|
||||
bool Calculation::exactAndApproximateOutputsAreEqual(Poincare::Context * context) {
|
||||
if (exactOutput(context)->type() != Expression::Type::Rational) {
|
||||
return false;
|
||||
}
|
||||
Expression * approximateOutput = Expression::ParseAndSimplify(m_approximateOutputText, *context);
|
||||
bool isEqual = approximateOutput->isIdenticalTo(exactOutput(context));
|
||||
delete approximateOutput;
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user