mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calc] If result contains random/round, display approximation only
This commit is contained in:
@@ -159,7 +159,15 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
|
||||
return DisplayOutput::ExactOnly;
|
||||
}
|
||||
bool approximateOnly = false;
|
||||
if (strcmp(m_exactOutputText, m_approximateOutputText) == 0) {
|
||||
if (exactOutput().recursivelyMatches([](const Expression e, Context & c, bool replaceSymbols) {
|
||||
/* If the exact result contains one of the following types, do not
|
||||
* display it. */
|
||||
ExpressionNode::Type t = e.type();
|
||||
return (t == ExpressionNode::Type::Random) || (t == ExpressionNode::Type::Round);},
|
||||
*context, true))
|
||||
{
|
||||
approximateOnly = true;
|
||||
} 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
|
||||
* because of the number of significant digits, we display both. */
|
||||
|
||||
Reference in New Issue
Block a user