mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] Clean code
This commit is contained in:
@@ -119,16 +119,18 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
|
||||
m_displayOutput = DisplayOutput::ExactOnly;
|
||||
} else if (input().recursivelyMatches(
|
||||
[](const Expression e, Context * c) {
|
||||
constexpr int approximateOnlyTypesCount = 5;
|
||||
/* If the input contains the following types, we only display the
|
||||
* approximate output. */
|
||||
ExpressionNode::Type t = e.type();
|
||||
return (t == ExpressionNode::Type::Random)
|
||||
|| (t == ExpressionNode::Type::Round)
|
||||
|| (t == ExpressionNode::Type::FracPart)
|
||||
|| (t == ExpressionNode::Type::ConfidenceInterval)
|
||||
|| (t == ExpressionNode::Type::PredictionInterval);
|
||||
},
|
||||
context, true))
|
||||
ExpressionNode::Type approximateOnlyTypes[approximateOnlyTypesCount] = {
|
||||
ExpressionNode::Type::Random,
|
||||
ExpressionNode::Type::Round,
|
||||
ExpressionNode::Type::FracPart,
|
||||
ExpressionNode::Type::ConfidenceInterval,
|
||||
ExpressionNode::Type::PredictionInterval
|
||||
};
|
||||
return e.isOfType(approximateOnlyTypes, approximateOnlyTypesCount);
|
||||
}, context, true))
|
||||
{
|
||||
m_displayOutput = DisplayOutput::ApproximateOnly;
|
||||
} else if (strcmp(exactOutputText(), approximateOutputText()) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user