[apps] Calculation: display the exact output even if identical to input

This commit is contained in:
Émilie Feral
2018-04-24 09:49:53 +02:00
committed by EmilieNumworks
parent 538bf216be
commit 98be622218

View File

@@ -68,8 +68,8 @@ void Calculation::setContent(const char * c, Context * context, Expression * ans
reset();
m_input = Expression::parse(c);
Expression::ReplaceSymbolWithExpression(&m_input, Symbol::SpecialSymbols::Ans, ansExpression);
/* We do not store directly the text enter by the user but its serialization
* to be able to compare it to the exact ouput text. */
/* We do not store directly the text enter by the user because we do not want
* to keep Ans symbol in the calculation store. */
m_input->writeTextInBuffer(m_inputText, sizeof(m_inputText));
m_exactOutput = Expression::ParseAndSimplify(m_inputText, *context);
m_exactOutput->writeTextInBuffer(m_exactOutputText, sizeof(m_exactOutputText));
@@ -186,9 +186,6 @@ bool Calculation::shouldDisplayApproximateOutput(Context * context) {
if (strcmp(m_exactOutputText, m_approximateOutputText) == 0) {
return true;
}
if (strcmp(m_exactOutputText, m_inputText) == 0) {
return true;
}
return input()->isApproximate(*context);
}