mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 16:20:49 +01:00
[calculation] No special case for unreal calculation, it is handled in
simplication and approximation routines.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include <poincare/symbol.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <poincare/unreal.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -53,13 +54,6 @@ void Calculation::setContent(const char * c, Context * context, Expression ansEx
|
||||
PoincareHelpers::ParseAndSimplifyAndApproximate(m_inputText, &exactOutput, &approximateOutput, *context);
|
||||
PoincareHelpers::Serialize(exactOutput, m_exactOutputText, sizeof(m_exactOutputText));
|
||||
PoincareHelpers::Serialize(approximateOutput, m_approximateOutputText, sizeof(m_approximateOutputText));
|
||||
/* Check ComplexFormat: if complex format is real and the input text doesn't
|
||||
* contain any i complex, both approximate and exact result are set to
|
||||
* Undefined if the approximate output is not a pure real.*/
|
||||
if (Preferences::sharedPreferences()->complexFormat() == Preferences::ComplexFormat::Real && strchr(m_inputText, Ion::Charset::IComplex) == nullptr && strchr(m_approximateOutputText, Ion::Charset::IComplex) != nullptr) {
|
||||
strlcpy(m_exactOutputText, Undefined::Name(), Constant::MaxSerializedExpressionSize);
|
||||
strlcpy(m_approximateOutputText, Undefined::Name(), Constant::MaxSerializedExpressionSize);
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate Calculation::height(Context * context) {
|
||||
@@ -161,7 +155,8 @@ bool Calculation::shouldOnlyDisplayApproximateOutput(Context * context) {
|
||||
* significant digits, the two layouts are not equal, we display both. */
|
||||
return exactAndApproximateDisplayedOutputsAreEqual(context) == Calculation::EqualSign::Equal;
|
||||
}
|
||||
if (strcmp(m_exactOutputText, Undefined::Name()) == 0) {
|
||||
if (strcmp(m_exactOutputText, Undefined::Name()) == 0 || strcmp(m_approximateOutputText, Unreal::Name()) == 0 ) {
|
||||
/* if the approximate result is 'unreal' or the exact result is 'undef'*/
|
||||
return true;
|
||||
}
|
||||
return input().isApproximate(*context) || exactOutput().isApproximate(*context);
|
||||
|
||||
Reference in New Issue
Block a user