[calculation] Calculations involving matrices display only approximate

results and should not toggle the exact output.
This commit is contained in:
Émilie Feral
2019-05-02 15:38:33 +02:00
parent f5cdf95bc5
commit 7f373a5c3c
2 changed files with 5 additions and 2 deletions

View File

@@ -180,6 +180,10 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
*context, true))
{
m_displayOutput = DisplayOutput::ApproximateOnly;
} else if (exactOutput().recursivelyMatches(Expression::IsMatrix, *context, false)) {
/* We do not need to replace symbols here because we recursively test the
* exact output where symbol have already been replaced. */
m_displayOutput = DisplayOutput::ApproximateOnly;
} else if (strcmp(m_exactOutputText, m_approximateOutputText) == 0) {
/* If the exact and approximate results' texts are equal and their layouts
* too, do not display the exact result. If the two layouts are not equal

View File

@@ -97,8 +97,7 @@ bool Expression::recursivelyMatches(ExpressionTest test, Context & context, bool
bool Expression::isApproximate(Context & context) const {
return recursivelyMatches([](const Expression e, Context & context, bool replaceSymbols) {
return e.type() == ExpressionNode::Type::Decimal
|| e.type() == ExpressionNode::Type::Float
|| IsMatrix(e, context, replaceSymbols)
|| e.type() == ExpressionNode::Type::Float
|| ((e.type() == ExpressionNode::Type::Symbol || e.type() == ExpressionNode::Type::Function)
&& replaceSymbols
&& SymbolAbstract::matches(