mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-28 10:09:53 +01:00
[calculation] Calculations involving matrices display only approximate
results and should not toggle the exact output.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user