[apps/calculation] Do not display additional results for Equal or Store

expressions
This commit is contained in:
Émilie Feral
2020-01-16 17:56:24 +01:00
committed by Léa Saviot
parent 2a37fa4447
commit 0c19b54365

View File

@@ -285,7 +285,16 @@ Calculation::EqualSign Calculation::exactAndApproximateDisplayedOutputsAreEqual(
Calculation::AdditionalInformationType Calculation::additionalInformationType(Context * context) {
Preferences * preferences = Preferences::sharedPreferences();
Preferences::ComplexFormat complexFormat = Expression::UpdatedComplexFormatWithTextInput(preferences->complexFormat(), m_inputText);
Expression i = input();
Expression o = exactOutput();
/* Special case for Equal and Store:
* Equal/Store nodes have to be at the root of the expression, which prevents
* from creating new expressions with equal/store node as a child. We don't
* return any additional outputs for them to avoid bothering with special
* cases. */
if (i.type() == ExpressionNode::Type::Equal || i.type() == ExpressionNode::Type::Store) {
return AdditionalInformationType::None;
}
/* Trigonometry additional results are displayed if either input or output is a sin or a cos. Indeed, we want to capture both cases:
* - > input: cos(60)
* > output: 1/2