diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 74725fc87..cc7ce0078 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -41,7 +41,7 @@ void Calculation::setContent(const char * c, Context * context, Expression ansEx * to keep Ans symbol in the calculation store. */ PoincareHelpers::Serialize(input, m_inputText, sizeof(m_inputText)); } - Expression exactOutput = PoincareHelpers::ParseAndSimplify(m_inputText, *context, true); + Expression exactOutput = PoincareHelpers::ParseAndSimplify(m_inputText, *context); PoincareHelpers::Serialize(exactOutput, m_exactOutputText, sizeof(m_exactOutputText)); Expression approximateOutput = PoincareHelpers::Approximate(exactOutput, *context); PoincareHelpers::Serialize(approximateOutput, m_approximateOutputText, sizeof(m_approximateOutputText)); diff --git a/apps/shared/poincare_helpers.h b/apps/shared/poincare_helpers.h index cbfe1a991..a9a2b9ef6 100644 --- a/apps/shared/poincare_helpers.h +++ b/apps/shared/poincare_helpers.h @@ -37,8 +37,8 @@ inline T ApproximateToScalar(const char * text, Poincare::Context & context) { return Poincare::Expression::approximateToScalar(text, context, Poincare::Preferences::sharedPreferences()->angleUnit()); } -inline Poincare::Expression ParseAndSimplify(const char * text, Poincare::Context & context, bool replaceSymbols = true) { - return Poincare::Expression::ParseAndSimplify(text, context, Poincare::Preferences::sharedPreferences()->angleUnit(), replaceSymbols); +inline Poincare::Expression ParseAndSimplify(const char * text, Poincare::Context & context) { + return Poincare::Expression::ParseAndSimplify(text, context, Poincare::Preferences::sharedPreferences()->angleUnit()); } inline void Simplify(Poincare::Expression * e, Poincare::Context & context) { diff --git a/apps/shared/storage_expression_model.cpp b/apps/shared/storage_expression_model.cpp index 678ea5f30..02e5b6272 100644 --- a/apps/shared/storage_expression_model.cpp +++ b/apps/shared/storage_expression_model.cpp @@ -39,7 +39,7 @@ Expression StorageExpressionModel::expressionReduced(Poincare::Context * context if (m_expression.isUninitialized()) { assert(!isNull()); Ion::Storage::Record::Data recordData = value(); - m_expression = Expression::ExpressionFromAddress(expressionAddressForValue(recordData), expressionSizeForValue(recordData)).reduce(*context, Preferences::AngleUnit::Degree, true); + m_expression = Expression::ExpressionFromAddress(expressionAddressForValue(recordData), expressionSizeForValue(recordData)).reduce(*context, Preferences::AngleUnit::Degree); } return m_expression; } diff --git a/poincare/include/poincare/absolute_value.h b/poincare/include/poincare/absolute_value.h index 0e90fc7bd..0f258122a 100644 --- a/poincare/include/poincare/absolute_value.h +++ b/poincare/include/poincare/absolute_value.h @@ -38,7 +38,7 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; }; class AbsoluteValue final : public Expression { @@ -49,7 +49,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("abs", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit AbsoluteValue(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/addition.h b/poincare/include/poincare/addition.h index 7f33727b3..0d50916a7 100644 --- a/poincare/include/poincare/addition.h +++ b/poincare/include/poincare/addition.h @@ -42,7 +42,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; /* Evaluation */ @@ -74,7 +74,7 @@ public: } } // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); int getPolynomialCoefficients(Context & context, const char * symbolName, Expression coefficients[]) const; private: diff --git a/poincare/include/poincare/arc_cosine.h b/poincare/include/poincare/arc_cosine.h index 2b27afa5f..ef6a8180c 100644 --- a/poincare/include/poincare/arc_cosine.h +++ b/poincare/include/poincare/arc_cosine.h @@ -27,7 +27,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; //Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -45,7 +45,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("acos", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit ArcCosine(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/arc_sine.h b/poincare/include/poincare/arc_sine.h index c2c45dc60..7afc40ce7 100644 --- a/poincare/include/poincare/arc_sine.h +++ b/poincare/include/poincare/arc_sine.h @@ -26,7 +26,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; //Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -44,7 +44,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("asin", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit ArcSine(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/arc_tangent.h b/poincare/include/poincare/arc_tangent.h index aef725f0e..3a8e17da6 100644 --- a/poincare/include/poincare/arc_tangent.h +++ b/poincare/include/poincare/arc_tangent.h @@ -26,7 +26,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; //Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -44,7 +44,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("atan", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit ArcTangent(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/binomial_coefficient.h b/poincare/include/poincare/binomial_coefficient.h index 7cb712b96..32edfeb5a 100644 --- a/poincare/include/poincare/binomial_coefficient.h +++ b/poincare/include/poincare/binomial_coefficient.h @@ -28,7 +28,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -43,7 +43,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("binomial", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: BinomialCoefficient(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/ceiling.h b/poincare/include/poincare/ceiling.h index e9bedee99..935e0fee2 100644 --- a/poincare/include/poincare/ceiling.h +++ b/poincare/include/poincare/ceiling.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -43,7 +43,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("ceil", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Ceiling(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/complex_argument.h b/poincare/include/poincare/complex_argument.h index c6e58d377..3b4780831 100644 --- a/poincare/include/poincare/complex_argument.h +++ b/poincare/include/poincare/complex_argument.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -43,7 +43,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("arg", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit ComplexArgument(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/confidence_interval.h b/poincare/include/poincare/confidence_interval.h index a0cee454c..3f68ccf0b 100644 --- a/poincare/include/poincare/confidence_interval.h +++ b/poincare/include/poincare/confidence_interval.h @@ -27,7 +27,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -50,7 +50,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("confidence", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: ConfidenceInterval(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/conjugate.h b/poincare/include/poincare/conjugate.h index 527efd36f..447195bb5 100644 --- a/poincare/include/poincare/conjugate.h +++ b/poincare/include/poincare/conjugate.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -43,7 +43,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("conj", 1, &UntypedBuilder);; - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Conjugate(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/cosine.h b/poincare/include/poincare/cosine.h index 56d326769..71edc314b 100644 --- a/poincare/include/poincare/cosine.h +++ b/poincare/include/poincare/cosine.h @@ -30,7 +30,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplication - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return ApproximationHelper::Map(this, context, angleUnit,computeOnComplex); @@ -47,7 +47,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("cos", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Cosine(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/decimal.h b/poincare/include/poincare/decimal.h index 1f08f6554..58b2eb0c4 100644 --- a/poincare/include/poincare/decimal.h +++ b/poincare/include/poincare/decimal.h @@ -62,7 +62,7 @@ public: int simplificationOrderSameType(const ExpressionNode * e, bool canBeInterrupted) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; // Serialization @@ -102,7 +102,7 @@ private: Decimal(size_t size, const Integer & m, int e); Expression setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit); // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); }; diff --git a/poincare/include/poincare/derivative.h b/poincare/include/poincare/derivative.h index 88f239bcc..728c4d4ea 100644 --- a/poincare/include/poincare/derivative.h +++ b/poincare/include/poincare/derivative.h @@ -29,7 +29,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -57,7 +57,7 @@ public: } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("diff", 3, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: Derivative(Expression child0, Expression child1, Expression child2) : Expression(TreePool::sharedPool()->createTreeNode()) { assert(child1.type() == ExpressionNode::Type::Symbol); diff --git a/poincare/include/poincare/determinant.h b/poincare/include/poincare/determinant.h index 1bcb6ef79..d9b87a5ac 100644 --- a/poincare/include/poincare/determinant.h +++ b/poincare/include/poincare/determinant.h @@ -24,7 +24,7 @@ private: /* Serialization */ int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; /* Simplification */ - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; /* Approximation */ Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -39,7 +39,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("det", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Determinant(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/division.h b/poincare/include/poincare/division.h index 5b2ea25ae..eb342f6ce 100644 --- a/poincare/include/poincare/division.h +++ b/poincare/include/poincare/division.h @@ -46,7 +46,7 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; private: template static Complex compute(const std::complex c, const std::complex d); @@ -66,7 +66,7 @@ public: } Division(const DivisionNode * n) : Expression(n) {} - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/division_quotient.h b/poincare/include/poincare/division_quotient.h index 6fbcf6575..8fabdb3bb 100644 --- a/poincare/include/poincare/division_quotient.h +++ b/poincare/include/poincare/division_quotient.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -39,7 +39,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("quo", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: DivisionQuotient(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/division_remainder.h b/poincare/include/poincare/division_remainder.h index 3d5c718a8..9f50f8ab3 100644 --- a/poincare/include/poincare/division_remainder.h +++ b/poincare/include/poincare/division_remainder.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -40,7 +40,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("rem", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: DivisionRemainder(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/equal.h b/poincare/include/poincare/equal.h index ab6171a1a..2cf80953b 100644 --- a/poincare/include/poincare/equal.h +++ b/poincare/include/poincare/equal.h @@ -22,7 +22,7 @@ public: int polynomialDegree(Context & context, const char * symbolName) const override { return -1; } private: // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Layout Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; @@ -43,7 +43,7 @@ public: // For the equation A = B, create the reduced expression A-B Expression standardEquation(Context & context, Preferences::AngleUnit angleUnit) const; // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index 67653c834..355b2fc0f 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -166,11 +166,11 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode = Preferences::PrintFloatMode::Decimal, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const; /* Simplification */ - static Expression ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); - Expression simplify(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); - Expression reduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); - void reduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return node()->reduceChildren(context, angleUnit, replaceSymbols); + static Expression ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit); + Expression simplify(Context & context, Preferences::AngleUnit angleUnit); + Expression reduce(Context & context, Preferences::AngleUnit angleUnit); + void reduceChildren(Context & context, Preferences::AngleUnit angleUnit) { + return node()->reduceChildren(context, angleUnit); } static Expression ExpressionWithoutSymbols(Expression expressionWithSymbols, Context & context); @@ -253,7 +253,7 @@ protected: /* Simplification */ Expression denominator(Context & context, Preferences::AngleUnit angleUnit) const { return node()->denominator(context, angleUnit); } - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) { return node()->shallowReduce(context, angleUnit, replaceSymbols); } + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { return node()->shallowReduce(context, angleUnit); } Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { return node()->shallowBeautify(context, angleUnit); } Expression deepBeautify(Context & context, Preferences::AngleUnit angleUnit); Expression setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit); @@ -262,13 +262,13 @@ private: static constexpr int k_maxSymbolReplacementsCount = 10; static bool sSymbolReplacementsCountLock; /* Simplification */ - Expression deepReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); - void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return node()->deepReduceChildren(context, angleUnit, replaceSymbols); + Expression deepReduce(Context & context, Preferences::AngleUnit angleUnit); + void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit) { + return node()->deepReduceChildren(context, angleUnit); } - void defaultReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols); - void defaultDeepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols); - Expression defaultShallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + void defaultReduceChildren(Context & context, Preferences::AngleUnit angleUnit); + void defaultDeepReduceChildren(Context & context, Preferences::AngleUnit angleUnit); + Expression defaultShallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression defaultShallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { return *this; } /* Approximation */ diff --git a/poincare/include/poincare/expression_node.h b/poincare/include/poincare/expression_node.h index 73cbad11b..0c07953cc 100644 --- a/poincare/include/poincare/expression_node.h +++ b/poincare/include/poincare/expression_node.h @@ -144,9 +144,9 @@ public: virtual Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const = 0; /* Simplification */ - /*!*/ virtual void reduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols); - /*!*/ virtual void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols); - /*!*/ virtual Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + /*!*/ virtual void reduceChildren(Context & context, Preferences::AngleUnit angleUnit); + /*!*/ virtual void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit); + /*!*/ virtual Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); /*!*/ virtual Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); /* Return a clone of the denominator part of the expression */ /*!*/ virtual Expression denominator(Context & context, Preferences::AngleUnit angleUnit) const; diff --git a/poincare/include/poincare/factorial.h b/poincare/include/poincare/factorial.h index 0a456004c..0fff397fe 100644 --- a/poincare/include/poincare/factorial.h +++ b/poincare/include/poincare/factorial.h @@ -27,7 +27,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplication - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); @@ -52,7 +52,7 @@ public: replaceChildAtIndexInPlace(0, child); } - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); private: constexpr static int k_maxOperandValue = 100; diff --git a/poincare/include/poincare/floor.h b/poincare/include/poincare/floor.h index 4227da23f..7e1125329 100644 --- a/poincare/include/poincare/floor.h +++ b/poincare/include/poincare/floor.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -43,7 +43,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("floor", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Floor(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/frac_part.h b/poincare/include/poincare/frac_part.h index 7587865a1..ef4599acc 100644 --- a/poincare/include/poincare/frac_part.h +++ b/poincare/include/poincare/frac_part.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -43,7 +43,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("frac", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit FracPart(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/function.h b/poincare/include/poincare/function.h index f8ec7c968..ba679f6cc 100644 --- a/poincare/include/poincare/function.h +++ b/poincare/include/poincare/function.h @@ -36,7 +36,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowReplaceReplaceableSymbols(Context & context) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override; @@ -64,7 +64,7 @@ public: // Simplification Expression replaceSymbolWithExpression(const SymbolAbstract & symbol, const Expression & expression); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowReplaceReplaceableSymbols(Context & context); private: //VariableContext unknownXContext(Context & parentContext) const; diff --git a/poincare/include/poincare/great_common_divisor.h b/poincare/include/poincare/great_common_divisor.h index 12fca9df5..2778167eb 100644 --- a/poincare/include/poincare/great_common_divisor.h +++ b/poincare/include/poincare/great_common_divisor.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -39,7 +39,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("gcd", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: GreatCommonDivisor(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/hyperbolic_trigonometric_function.h b/poincare/include/poincare/hyperbolic_trigonometric_function.h index 886ed020b..8160b0008 100644 --- a/poincare/include/poincare/hyperbolic_trigonometric_function.h +++ b/poincare/include/poincare/hyperbolic_trigonometric_function.h @@ -12,13 +12,13 @@ public: int numberOfChildren() const override { return 1; } private: // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; }; class HyperbolicTrigonometricFunction : public Expression { public: HyperbolicTrigonometricFunction(const HyperbolicTrigonometricFunctionNode * n) : Expression(n) {} - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/imaginary_part.h b/poincare/include/poincare/imaginary_part.h index 5932bc556..9842ffcf8 100644 --- a/poincare/include/poincare/imaginary_part.h +++ b/poincare/include/poincare/imaginary_part.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit) { return Complex(std::imag(c)); @@ -45,7 +45,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("im", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit ImaginaryPart(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/integral.h b/poincare/include/poincare/integral.h index 621065698..36c38bc15 100644 --- a/poincare/include/poincare/integral.h +++ b/poincare/include/poincare/integral.h @@ -26,7 +26,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -61,7 +61,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("int", 4, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: Integral(Expression child0, Expression child1, Expression child2, Expression child3) : Expression(TreePool::sharedPool()->createTreeNode()) { assert(child1.type() == ExpressionNode::Type::Symbol); diff --git a/poincare/include/poincare/least_common_multiple.h b/poincare/include/poincare/least_common_multiple.h index 0651074e6..9e804125d 100644 --- a/poincare/include/poincare/least_common_multiple.h +++ b/poincare/include/poincare/least_common_multiple.h @@ -23,7 +23,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; /* Simplification */ - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; /* Evaluation */ Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -38,7 +38,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("lcm", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: LeastCommonMultiple(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/logarithm.h b/poincare/include/poincare/logarithm.h index 178038192..c37003534 100644 --- a/poincare/include/poincare/logarithm.h +++ b/poincare/include/poincare/logarithm.h @@ -27,7 +27,7 @@ public: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit) { @@ -48,7 +48,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0), children.childAtIndex(1)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("log", 2, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); private: @@ -69,7 +69,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("log", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit CommonLogarithm(Expression child) : Expression(TreePool::sharedPool()->createTreeNode >()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/matrix_dimension.h b/poincare/include/poincare/matrix_dimension.h index 30605288c..8b320adc6 100644 --- a/poincare/include/poincare/matrix_dimension.h +++ b/poincare/include/poincare/matrix_dimension.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -38,7 +38,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("dim", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit MatrixDimension(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/matrix_inverse.h b/poincare/include/poincare/matrix_inverse.h index a387493e6..81c81c9ff 100644 --- a/poincare/include/poincare/matrix_inverse.h +++ b/poincare/include/poincare/matrix_inverse.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -38,7 +38,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("inverse", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit MatrixInverse(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/matrix_trace.h b/poincare/include/poincare/matrix_trace.h index 0ba769a6a..9acaf4fa8 100644 --- a/poincare/include/poincare/matrix_trace.h +++ b/poincare/include/poincare/matrix_trace.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -38,7 +38,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("trace", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit MatrixTrace(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/matrix_transpose.h b/poincare/include/poincare/matrix_transpose.h index b5577879b..fd0e163f1 100644 --- a/poincare/include/poincare/matrix_transpose.h +++ b/poincare/include/poincare/matrix_transpose.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -38,7 +38,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("transpose", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit MatrixTranspose(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/multiplication.h b/poincare/include/poincare/multiplication.h index 849cd894d..e66937972 100644 --- a/poincare/include/poincare/multiplication.h +++ b/poincare/include/poincare/multiplication.h @@ -44,7 +44,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; Expression denominator(Context & context, Preferences::AngleUnit angleUnit) const override; @@ -81,7 +81,7 @@ public: template static void computeOnArrays(T * m, T * n, T * result, int mNumberOfColumns, int mNumberOfRows, int nNumberOfColumns); // Expression Expression setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); int getPolynomialCoefficients(Context & context, const char * symbolName, Expression coefficients[]) const; Expression denominator(Context & context, Preferences::AngleUnit angleUnit) const; diff --git a/poincare/include/poincare/naperian_logarithm.h b/poincare/include/poincare/naperian_logarithm.h index 86f11552c..a00c8fe8d 100644 --- a/poincare/include/poincare/naperian_logarithm.h +++ b/poincare/include/poincare/naperian_logarithm.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; /* Evaluation */ template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit) { /* ln has a branch cut on ]-inf, 0]: it is then multivalued on this cut. We @@ -48,7 +48,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("ln", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit NaperianLogarithm(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/nth_root.h b/poincare/include/poincare/nth_root.h index 650f6447a..69a16ae1f 100644 --- a/poincare/include/poincare/nth_root.h +++ b/poincare/include/poincare/nth_root.h @@ -24,7 +24,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -39,7 +39,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0), children.childAtIndex(1)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("root", 2, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: NthRoot(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/opposite.h b/poincare/include/poincare/opposite.h index 32a2b9224..cb1b07c82 100644 --- a/poincare/include/poincare/opposite.h +++ b/poincare/include/poincare/opposite.h @@ -41,7 +41,7 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode = Preferences::PrintFloatMode::Decimal, int numberOfSignificantDigits = 0) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; }; class Opposite final : public Expression { @@ -52,7 +52,7 @@ public: replaceChildAtIndexInPlace(0, child); } - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/parenthesis.h b/poincare/include/poincare/parenthesis.h index 46d81809f..291238613 100644 --- a/poincare/include/poincare/parenthesis.h +++ b/poincare/include/poincare/parenthesis.h @@ -25,7 +25,7 @@ public: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Approximation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -41,7 +41,7 @@ public: replaceChildAtIndexInPlace(0, exp); } // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/permute_coefficient.h b/poincare/include/poincare/permute_coefficient.h index e7e6b400f..a35ff34ba 100644 --- a/poincare/include/poincare/permute_coefficient.h +++ b/poincare/include/poincare/permute_coefficient.h @@ -27,7 +27,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -42,7 +42,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("permute", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: PermuteCoefficient(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/power.h b/poincare/include/poincare/power.h index f50a9959b..fbfa27881 100644 --- a/poincare/include/poincare/power.h +++ b/poincare/include/poincare/power.h @@ -42,7 +42,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplify - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; int simplificationOrderGreaterType(const ExpressionNode * e, bool canBeInterrupted) const override; int simplificationOrderSameType(const ExpressionNode * e, bool canBeInterrupted) const override; @@ -67,7 +67,7 @@ public: Power(const PowerNode * n) : Expression(n) {} Expression setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit); int getPolynomialCoefficients(Context & context, const char * symbolName, Expression coefficients[]) const; - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit); private: diff --git a/poincare/include/poincare/prediction_interval.h b/poincare/include/poincare/prediction_interval.h index d8e6f8c02..97ed0bba7 100644 --- a/poincare/include/poincare/prediction_interval.h +++ b/poincare/include/poincare/prediction_interval.h @@ -27,7 +27,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -42,7 +42,7 @@ public: static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("prediction95", 2, &UntypedBuilder); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: PredictionInterval(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/rational.h b/poincare/include/poincare/rational.h index 7b8982e41..3113f8b5f 100644 --- a/poincare/include/poincare/rational.h +++ b/poincare/include/poincare/rational.h @@ -57,7 +57,7 @@ public: static int NaturalOrder(const RationalNode * i, const RationalNode * j); private: int simplificationOrderSameType(const ExpressionNode * e, bool canBeInterrupted) const override; - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override; Expression setSign(Sign s, Context & context, Preferences::AngleUnit angleUnit) override; Expression denominator(Context & context, Preferences::AngleUnit angleUnit) const override; @@ -108,7 +108,7 @@ public: static int NaturalOrder(const Rational & i, const Rational & j) { return RationalNode::NaturalOrder(i.node(), j.node()); } // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: Rational(const native_uint_t * i, uint8_t numeratorSize, const native_uint_t * j, uint8_t denominatorSize, bool negative); diff --git a/poincare/include/poincare/real_part.h b/poincare/include/poincare/real_part.h index 3e7fd358b..d247425ae 100644 --- a/poincare/include/poincare/real_part.h +++ b/poincare/include/poincare/real_part.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit) { return Complex(std::real(c)); @@ -45,7 +45,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("re", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit RealPart(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/round.h b/poincare/include/poincare/round.h index e96269d10..12b751cae 100644 --- a/poincare/include/poincare/round.h +++ b/poincare/include/poincare/round.h @@ -25,7 +25,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } Evaluation approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate(context, angleUnit); } @@ -39,7 +39,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0), children.childAtIndex(1)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("round", 2, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: Round(Expression child0, Expression child1) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child0); diff --git a/poincare/include/poincare/sine.h b/poincare/include/poincare/sine.h index fb63222fe..4536f0c2b 100644 --- a/poincare/include/poincare/sine.h +++ b/poincare/include/poincare/sine.h @@ -31,7 +31,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplication - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -49,7 +49,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("sin", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Sine(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/square_root.h b/poincare/include/poincare/square_root.h index e711b66d9..a4c577609 100644 --- a/poincare/include/poincare/square_root.h +++ b/poincare/include/poincare/square_root.h @@ -27,7 +27,7 @@ private: Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplification - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit); Evaluation approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { @@ -46,7 +46,7 @@ public: static_assert('\x91' == Ion::Charset::Root, "Charset error"); static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("\x91", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit SquareRoot(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/include/poincare/store.h b/poincare/include/poincare/store.h index aabeb6603..6ace438cc 100644 --- a/poincare/include/poincare/store.h +++ b/poincare/include/poincare/store.h @@ -25,9 +25,9 @@ public: private: // Simplification - void reduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) override; - void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) override; - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + void reduceChildren(Context & context, Preferences::AngleUnit angleUnit) override; + void deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Layout Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; @@ -56,7 +56,7 @@ public: } // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/subtraction.h b/poincare/include/poincare/subtraction.h index 8ae2a86bb..a44a28699 100644 --- a/poincare/include/poincare/subtraction.h +++ b/poincare/include/poincare/subtraction.h @@ -39,7 +39,7 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; /* Simplification */ - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; private: /* Evaluation */ @@ -62,7 +62,7 @@ public: } // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); }; } diff --git a/poincare/include/poincare/symbol.h b/poincare/include/poincare/symbol.h index 81fca8f9b..679702d89 100644 --- a/poincare/include/poincare/symbol.h +++ b/poincare/include/poincare/symbol.h @@ -30,7 +30,7 @@ public: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; /* Simplification */ - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; Expression shallowReplaceReplaceableSymbols(Context & context) override; /* Approximation */ @@ -75,7 +75,7 @@ public: static bool isRegressionSymbol(const char * c); // Expression - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); Expression replaceSymbolWithExpression(const SymbolAbstract & symbol, const Expression & expression); int getPolynomialCoefficients(Context & context, const char * symbolName, Expression coefficients[]) const; Expression shallowReplaceReplaceableSymbols(Context & context); diff --git a/poincare/include/poincare/tangent.h b/poincare/include/poincare/tangent.h index 4ac14a7c5..93f041dd6 100644 --- a/poincare/include/poincare/tangent.h +++ b/poincare/include/poincare/tangent.h @@ -28,7 +28,7 @@ private: int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; // Simplication - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override; + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit) override; // Evaluation template static Complex computeOnComplex(const std::complex c, Preferences::AngleUnit angleUnit = Preferences::AngleUnit::Radian); @@ -47,7 +47,7 @@ public: static Expression UntypedBuilder(Expression children) { return Builder(children.childAtIndex(0)); } static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("tan", 1, &UntypedBuilder); - Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true); + Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit); private: explicit Tangent(Expression child) : Expression(TreePool::sharedPool()->createTreeNode()) { replaceChildAtIndexInPlace(0, child); diff --git a/poincare/src/absolute_value.cpp b/poincare/src/absolute_value.cpp index ae17b2650..8879e02d7 100644 --- a/poincare/src/absolute_value.cpp +++ b/poincare/src/absolute_value.cpp @@ -24,8 +24,8 @@ int AbsoluteValueNode::serialize(char * buffer, int bufferSize, Preferences::Pri return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, AbsoluteValue::s_functionHelper.name()); } -Expression AbsoluteValueNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return AbsoluteValue(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression AbsoluteValueNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return AbsoluteValue(this).shallowReduce(context, angleUnit); } Expression AbsoluteValue::setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit) { @@ -33,7 +33,7 @@ Expression AbsoluteValue::setSign(ExpressionNode::Sign s, Context & context, Pre return *this; } -Expression AbsoluteValue::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression AbsoluteValue::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { return e; diff --git a/poincare/src/addition.cpp b/poincare/src/addition.cpp index 929e41745..ce57ef66a 100644 --- a/poincare/src/addition.cpp +++ b/poincare/src/addition.cpp @@ -51,8 +51,8 @@ int AdditionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo // Simplication -Expression AdditionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Addition(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression AdditionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Addition(this).shallowReduce(context, angleUnit); } Expression AdditionNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -141,7 +141,7 @@ Expression Addition::shallowBeautify(Context & context, Preferences::AngleUnit a return result; } -Expression Addition::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Addition::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/arc_cosine.cpp b/poincare/src/arc_cosine.cpp index dc5755922..b32600a7b 100644 --- a/poincare/src/arc_cosine.cpp +++ b/poincare/src/arc_cosine.cpp @@ -19,8 +19,8 @@ int ArcCosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFl return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ArcCosine::s_functionHelper.name()); } -Expression ArcCosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ArcCosine(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ArcCosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ArcCosine(this).shallowReduce(context, angleUnit); } template @@ -38,7 +38,7 @@ Complex ArcCosineNode::computeOnComplex(const std::complex c, Preferences: return Complex(Trigonometry::ConvertRadianToAngleUnit(result, angleUnit)); } -Expression ArcCosine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ArcCosine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/arc_sine.cpp b/poincare/src/arc_sine.cpp index db93fc168..467487d9f 100644 --- a/poincare/src/arc_sine.cpp +++ b/poincare/src/arc_sine.cpp @@ -19,8 +19,8 @@ int ArcSineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloa return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ArcSine::s_functionHelper.name()); } -Expression ArcSineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ArcSine(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ArcSineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ArcSine(this).shallowReduce(context, angleUnit); } template @@ -38,7 +38,7 @@ Complex ArcSineNode::computeOnComplex(const std::complex c, Preferences::A return Complex(Trigonometry::ConvertRadianToAngleUnit(result, angleUnit)); } -Expression ArcSine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ArcSine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/arc_tangent.cpp b/poincare/src/arc_tangent.cpp index 04d78cabf..bba000816 100644 --- a/poincare/src/arc_tangent.cpp +++ b/poincare/src/arc_tangent.cpp @@ -34,11 +34,11 @@ Complex ArcTangentNode::computeOnComplex(const std::complex c, Preferences return Complex(Trigonometry::ConvertRadianToAngleUnit(result, angleUnit)); } -Expression ArcTangentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ArcTangent(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ArcTangentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ArcTangent(this).shallowReduce(context, angleUnit); } -Expression ArcTangent::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ArcTangent::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/binomial_coefficient.cpp b/poincare/src/binomial_coefficient.cpp index 3d162c274..96a2f101f 100644 --- a/poincare/src/binomial_coefficient.cpp +++ b/poincare/src/binomial_coefficient.cpp @@ -14,8 +14,8 @@ constexpr Expression::FunctionHelper BinomialCoefficient::s_functionHelper; int BinomialCoefficientNode::numberOfChildren() const { return BinomialCoefficient::s_functionHelper.numberOfChildren(); } -Expression BinomialCoefficientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return BinomialCoefficient(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression BinomialCoefficientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return BinomialCoefficient(this).shallowReduce(context, angleUnit); } Layout BinomialCoefficientNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -53,7 +53,7 @@ T BinomialCoefficientNode::compute(T k, T n) { return std::round(result); } -Expression BinomialCoefficient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression BinomialCoefficient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/ceiling.cpp b/poincare/src/ceiling.cpp index 442eedabf..3470591c6 100644 --- a/poincare/src/ceiling.cpp +++ b/poincare/src/ceiling.cpp @@ -31,11 +31,11 @@ Complex CeilingNode::computeOnComplex(const std::complex c, Preferences::A return Complex(std::ceil(c.real())); } -Expression CeilingNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Ceiling(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression CeilingNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Ceiling(this).shallowReduce(context, angleUnit); } -Expression Ceiling::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Ceiling::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/complex_argument.cpp b/poincare/src/complex_argument.cpp index 591bf5a8b..e8f23b5b9 100644 --- a/poincare/src/complex_argument.cpp +++ b/poincare/src/complex_argument.cpp @@ -21,8 +21,8 @@ int ComplexArgumentNode::serialize(char * buffer, int bufferSize, Preferences::P return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ComplexArgument::s_functionHelper.name()); } -Expression ComplexArgumentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ComplexArgument(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ComplexArgumentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ComplexArgument(this).shallowReduce(context, angleUnit); } template @@ -30,7 +30,7 @@ Complex ComplexArgumentNode::computeOnComplex(const std::complex c, Prefer return Complex(std::arg(c)); } -Expression ComplexArgument::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ComplexArgument::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/confidence_interval.cpp b/poincare/src/confidence_interval.cpp index f095211fb..a3a2e5f1b 100644 --- a/poincare/src/confidence_interval.cpp +++ b/poincare/src/confidence_interval.cpp @@ -25,8 +25,8 @@ int ConfidenceIntervalNode::serialize(char * buffer, int bufferSize, Preferences return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ConfidenceInterval::s_functionHelper.name()); } -Expression ConfidenceIntervalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ConfidenceInterval(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ConfidenceIntervalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ConfidenceInterval(this).shallowReduce(context, angleUnit); } template @@ -52,7 +52,7 @@ int SimplePredictionIntervalNode::serialize(char * buffer, int bufferSize, Prefe return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, SimplePredictionInterval::s_functionHelper.name()); } -Expression ConfidenceInterval::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ConfidenceInterval::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { @@ -94,7 +94,7 @@ Expression ConfidenceInterval::shallowReduce(Context & context, Preferences::Ang matrix.addChildAtIndexInPlace(Addition(r0, sqr), 1, 1); matrix.setDimensions(1, 2); replaceWithInPlace(matrix); - matrix.deepReduceChildren(context, angleUnit, replaceSymbols); + matrix.deepReduceChildren(context, angleUnit); return matrix; } diff --git a/poincare/src/conjugate.cpp b/poincare/src/conjugate.cpp index 3fee9256d..a9171695b 100644 --- a/poincare/src/conjugate.cpp +++ b/poincare/src/conjugate.cpp @@ -19,8 +19,8 @@ int ConjugateNode::serialize(char * buffer, int bufferSize, Preferences::PrintFl return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Conjugate::s_functionHelper.name()); } -Expression ConjugateNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Conjugate(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ConjugateNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Conjugate(this).shallowReduce(context, angleUnit); } template @@ -28,7 +28,7 @@ Complex ConjugateNode::computeOnComplex(const std::complex c, Preferences: return Complex(std::conj(c)); } -Expression Conjugate::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Conjugate::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/cosine.cpp b/poincare/src/cosine.cpp index eaf47f4f5..42f6d585a 100644 --- a/poincare/src/cosine.cpp +++ b/poincare/src/cosine.cpp @@ -30,11 +30,11 @@ int CosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloat return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Cosine::s_functionHelper.name()); } -Expression CosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Cosine(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression CosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Cosine(this).shallowReduce(context, angleUnit); } -Expression Cosine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Cosine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/decimal.cpp b/poincare/src/decimal.cpp index 8e3ba1a15..c26b31ae4 100644 --- a/poincare/src/decimal.cpp +++ b/poincare/src/decimal.cpp @@ -85,8 +85,8 @@ int DecimalNode::simplificationOrderSameType(const ExpressionNode * e, bool canB return ((int)sign())*unsignedComparison; } -Expression DecimalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Decimal(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DecimalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Decimal(this).shallowReduce(context, angleUnit); } Expression DecimalNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -342,7 +342,7 @@ Expression Decimal::setSign(ExpressionNode::Sign s, Context & context, Preferenc return result; } -Expression Decimal::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Decimal::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { return e; diff --git a/poincare/src/derivative.cpp b/poincare/src/derivative.cpp index 81ad1d2c3..e8dc03a77 100644 --- a/poincare/src/derivative.cpp +++ b/poincare/src/derivative.cpp @@ -34,8 +34,8 @@ int DerivativeNode::serialize(char * buffer, int bufferSize, Preferences::PrintF return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Derivative::s_functionHelper.name()); } -Expression DerivativeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Derivative(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DerivativeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Derivative(this).shallowReduce(context, angleUnit); } template @@ -132,7 +132,7 @@ T DerivativeNode::riddersApproximation(Context & context, Preferences::AngleUnit return ans; } -Expression Derivative::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Derivative::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/determinant.cpp b/poincare/src/determinant.cpp index 2a570c2b2..d000d90cb 100644 --- a/poincare/src/determinant.cpp +++ b/poincare/src/determinant.cpp @@ -28,11 +28,11 @@ Evaluation DeterminantNode::templatedApproximate(Context& context, Preference return Complex(input.determinant()); } -Expression DeterminantNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Determinant(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DeterminantNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Determinant(this).shallowReduce(context, angleUnit); } -Expression Determinant::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Determinant::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/division.cpp b/poincare/src/division.cpp index 7a3fdbc0e..bdf65cab2 100644 --- a/poincare/src/division.cpp +++ b/poincare/src/division.cpp @@ -40,8 +40,8 @@ int DivisionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "/"); } -Expression DivisionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Division(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DivisionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Division(this).shallowReduce(context, angleUnit); } template Complex DivisionNode::compute(const std::complex c, const std::complex d) { @@ -67,7 +67,7 @@ template MatrixComplex DivisionNode::computeOnMatrices(const Matr Division::Division() : Expression(TreePool::sharedPool()->createTreeNode()) {} -Expression Division::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Division::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/division_quotient.cpp b/poincare/src/division_quotient.cpp index 5cc220262..226b5b9e2 100644 --- a/poincare/src/division_quotient.cpp +++ b/poincare/src/division_quotient.cpp @@ -12,8 +12,8 @@ constexpr Expression::FunctionHelper DivisionQuotient::s_functionHelper; int DivisionQuotientNode::numberOfChildren() const { return DivisionQuotient::s_functionHelper.numberOfChildren(); } -Expression DivisionQuotientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return DivisionQuotient(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DivisionQuotientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return DivisionQuotient(this).shallowReduce(context, angleUnit); } Layout DivisionQuotientNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -35,7 +35,7 @@ Evaluation DivisionQuotientNode::templatedApproximate(Context& context, Prefe return Complex(std::floor(f1/f2)); } -Expression DivisionQuotient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression DivisionQuotient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/division_remainder.cpp b/poincare/src/division_remainder.cpp index 7a9328707..b2c21adc2 100644 --- a/poincare/src/division_remainder.cpp +++ b/poincare/src/division_remainder.cpp @@ -20,8 +20,8 @@ int DivisionRemainderNode::serialize(char * buffer, int bufferSize, Preferences: return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, DivisionRemainder::s_functionHelper.name()); } -Expression DivisionRemainderNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return DivisionRemainder(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression DivisionRemainderNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return DivisionRemainder(this).shallowReduce(context, angleUnit); } template @@ -36,7 +36,7 @@ Evaluation DivisionRemainderNode::templatedApproximate(Context& context, Pref return Complex(std::round(f1-f2*std::floor(f1/f2))); } -Expression DivisionRemainder::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression DivisionRemainder::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/equal.cpp b/poincare/src/equal.cpp index 3bcb7469f..e23faa1d8 100644 --- a/poincare/src/equal.cpp +++ b/poincare/src/equal.cpp @@ -20,8 +20,8 @@ extern "C" { } namespace Poincare { -Expression EqualNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Equal(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression EqualNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Equal(this).shallowReduce(context, angleUnit); } Layout EqualNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -46,7 +46,7 @@ Expression Equal::standardEquation(Context & context, Preferences::AngleUnit ang return sub.reduce(context, angleUnit); } -Expression Equal::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Equal::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 33e06e1fc..a49b0737d 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -195,19 +195,19 @@ bool Expression::getLinearCoefficients(char * variables, int maxVariableSize, Ex // Private -void Expression::defaultReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +void Expression::defaultReduceChildren(Context & context, Preferences::AngleUnit angleUnit) { for (int i = 0; i < numberOfChildren(); i++) { - childAtIndex(i).reduce(context, angleUnit, replaceSymbols); + childAtIndex(i).reduce(context, angleUnit); } } -void Expression::defaultDeepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +void Expression::defaultDeepReduceChildren(Context & context, Preferences::AngleUnit angleUnit) { for (int i = 0; i < numberOfChildren(); i++) { - childAtIndex(i).deepReduce(context, angleUnit, replaceSymbols); + childAtIndex(i).deepReduce(context, angleUnit); } } -Expression Expression::defaultShallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Expression::defaultShallowReduce(Context & context, Preferences::AngleUnit angleUnit) { for (int i = 0; i < numberOfChildren(); i++) { if (childAtIndex(i).type() == ExpressionNode::Type::Undefined) { Expression result = Undefined(); @@ -308,12 +308,12 @@ int Expression::serialize(char * buffer, int bufferSize, Preferences::PrintFloat /* Simplification */ -Expression Expression::ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Expression::ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit) { Expression exp = Parse(text); if (exp.isUninitialized()) { return Undefined(); } - exp = exp.simplify(context, angleUnit, replaceSymbols); + exp = exp.simplify(context, angleUnit); /* simplify might have been interrupted, in which case the resulting * expression is uninitialized, so we need to check that. */ if (exp.isUninitialized()) { @@ -322,9 +322,9 @@ Expression Expression::ParseAndSimplify(const char * text, Context & context, Pr return exp; } -Expression Expression::simplify(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Expression::simplify(Context & context, Preferences::AngleUnit angleUnit) { sSimplificationHasBeenInterrupted = false; - Expression e = reduce(context, angleUnit, replaceSymbols); + Expression e = reduce(context, angleUnit); if (!sSimplificationHasBeenInterrupted) { e = e.deepBeautify(context, angleUnit); } @@ -362,25 +362,25 @@ Expression Expression::ExpressionWithoutSymbols(Expression e, Context & context) return e; } -Expression Expression::reduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Expression::reduce(Context & context, Preferences::AngleUnit angleUnit) { sSimplificationHasBeenInterrupted = false; - return deepReduce(context, angleUnit, replaceSymbols); + return deepReduce(context, angleUnit); } -Expression Expression::deepReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Expression::deepReduce(Context & context, Preferences::AngleUnit angleUnit) { #if MATRIX_EXACT_REDUCING #else - if (IsMatrix(*this, context, replaceSymbols)) { + if (IsMatrix(*this, context, true)) { sSimplificationHasBeenInterrupted = true; return *this; } #endif - deepReduceChildren(context, angleUnit, replaceSymbols); + deepReduceChildren(context, angleUnit); if (sSimplificationHasBeenInterrupted) { return *this; } - return shallowReduce(context, angleUnit, replaceSymbols); + return shallowReduce(context, angleUnit); } Expression Expression::deepBeautify(Context & context, Preferences::AngleUnit angleUnit) { diff --git a/poincare/src/expression_node.cpp b/poincare/src/expression_node.cpp index 97719c681..ac020003c 100644 --- a/poincare/src/expression_node.cpp +++ b/poincare/src/expression_node.cpp @@ -95,16 +95,16 @@ int ExpressionNode::simplificationOrderSameType(const ExpressionNode * e, bool c return 0; } -void ExpressionNode::reduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - Expression(this).defaultReduceChildren(context, angleUnit, replaceSymbols); +void ExpressionNode::reduceChildren(Context & context, Preferences::AngleUnit angleUnit) { + Expression(this).defaultReduceChildren(context, angleUnit); } -void ExpressionNode::deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - Expression(this).defaultDeepReduceChildren(context, angleUnit, replaceSymbols); +void ExpressionNode::deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit) { + Expression(this).defaultDeepReduceChildren(context, angleUnit); } -Expression ExpressionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Expression(this).defaultShallowReduce(context, angleUnit, replaceSymbols); +Expression ExpressionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Expression(this).defaultShallowReduce(context, angleUnit); } Expression ExpressionNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { diff --git a/poincare/src/factorial.cpp b/poincare/src/factorial.cpp index 9a785f974..b94d37bbe 100644 --- a/poincare/src/factorial.cpp +++ b/poincare/src/factorial.cpp @@ -27,8 +27,8 @@ bool FactorialNode::childNeedsParenthesis(const TreeNode * child) const { // Simplification -Expression FactorialNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Factorial(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression FactorialNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Factorial(this).shallowReduce(context, angleUnit); } Expression FactorialNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -84,7 +84,7 @@ int FactorialNode::serialize(char * buffer, int bufferSize, Preferences::PrintFl Factorial::Factorial() : Expression(TreePool::sharedPool()->createTreeNode()) {} -Expression Factorial::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Factorial::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/floor.cpp b/poincare/src/floor.cpp index 344e51109..60a110548 100644 --- a/poincare/src/floor.cpp +++ b/poincare/src/floor.cpp @@ -31,11 +31,11 @@ Complex FloorNode::computeOnComplex(const std::complex c, Preferences::Ang return Complex(std::floor(c.real())); } -Expression FloorNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Floor(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression FloorNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Floor(this).shallowReduce(context, angleUnit); } -Expression Floor::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Floor::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/frac_part.cpp b/poincare/src/frac_part.cpp index 113f8cdf9..fcee4402a 100644 --- a/poincare/src/frac_part.cpp +++ b/poincare/src/frac_part.cpp @@ -19,8 +19,8 @@ int FracPartNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, FracPart::s_functionHelper.name()); } -Expression FracPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return FracPart(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression FracPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return FracPart(this).shallowReduce(context, angleUnit); } template @@ -31,7 +31,7 @@ Complex FracPartNode::computeOnComplex(const std::complex c, Preferences:: return Complex(c.real()-std::floor(c.real())); } -Expression FracPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression FracPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/function.cpp b/poincare/src/function.cpp index d4ce8f4d1..9b6e4eb2e 100644 --- a/poincare/src/function.cpp +++ b/poincare/src/function.cpp @@ -57,8 +57,8 @@ int FunctionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name()); } -Expression FunctionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Function(this).shallowReduce(context, angleUnit, replaceSymbols); // This uses Symbol::shallowReduce +Expression FunctionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Function(this).shallowReduce(context, angleUnit); // This uses Symbol::shallowReduce } Expression FunctionNode::shallowReplaceReplaceableSymbols(Context & context) { @@ -108,15 +108,12 @@ Expression Function::replaceSymbolWithExpression(const SymbolAbstract & symbol, return *this; } -Expression Function::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - if (!replaceSymbols) { - return *this; - } +Expression Function::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Function f(*this); Expression e = SymbolAbstract::Expand(f, context, true); if (!e.isUninitialized()) { replaceWithInPlace(e); - return e.deepReduce(context, angleUnit, replaceSymbols); + return e.deepReduce(context, angleUnit); } return *this; } diff --git a/poincare/src/great_common_divisor.cpp b/poincare/src/great_common_divisor.cpp index 5d1748252..6385c092c 100644 --- a/poincare/src/great_common_divisor.cpp +++ b/poincare/src/great_common_divisor.cpp @@ -20,8 +20,8 @@ int GreatCommonDivisorNode::serialize(char * buffer, int bufferSize, Preferences return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, GreatCommonDivisor::s_functionHelper.name()); } -Expression GreatCommonDivisorNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return GreatCommonDivisor(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression GreatCommonDivisorNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return GreatCommonDivisor(this).shallowReduce(context, angleUnit); } template @@ -48,7 +48,7 @@ Evaluation GreatCommonDivisorNode::templatedApproximate(Context& context, Pre return Complex(std::round((T)a)); } -Expression GreatCommonDivisor::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression GreatCommonDivisor::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/hyperbolic_trigonometric_function.cpp b/poincare/src/hyperbolic_trigonometric_function.cpp index 173b757a2..df0a473f9 100644 --- a/poincare/src/hyperbolic_trigonometric_function.cpp +++ b/poincare/src/hyperbolic_trigonometric_function.cpp @@ -2,11 +2,11 @@ namespace Poincare { -Expression HyperbolicTrigonometricFunctionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return HyperbolicTrigonometricFunction(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression HyperbolicTrigonometricFunctionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return HyperbolicTrigonometricFunction(this).shallowReduce(context, angleUnit); } -Expression HyperbolicTrigonometricFunction::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression HyperbolicTrigonometricFunction::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/imaginary_part.cpp b/poincare/src/imaginary_part.cpp index d93e9d7f8..cd020d106 100644 --- a/poincare/src/imaginary_part.cpp +++ b/poincare/src/imaginary_part.cpp @@ -19,11 +19,11 @@ int ImaginaryPartNode::serialize(char * buffer, int bufferSize, Preferences::Pri return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ImaginaryPart::s_functionHelper.name()); } -Expression ImaginaryPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return ImaginaryPart(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ImaginaryPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return ImaginaryPart(this).shallowReduce(context, angleUnit); } -Expression ImaginaryPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression ImaginaryPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/integral.cpp b/poincare/src/integral.cpp index 0c08f2b30..6ee2640be 100644 --- a/poincare/src/integral.cpp +++ b/poincare/src/integral.cpp @@ -38,8 +38,8 @@ int IntegralNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Integral::s_functionHelper.name()); } -Expression IntegralNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Integral(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression IntegralNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Integral(this).shallowReduce(context, angleUnit); } template @@ -190,7 +190,7 @@ T IntegralNode::adaptiveQuadrature(T a, T b, T eps, int numberOfIterations, Cont } #endif -Expression Integral::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Integral::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/least_common_multiple.cpp b/poincare/src/least_common_multiple.cpp index 18644c1a3..1a0aa5ad7 100644 --- a/poincare/src/least_common_multiple.cpp +++ b/poincare/src/least_common_multiple.cpp @@ -21,8 +21,8 @@ int LeastCommonMultipleNode::serialize(char * buffer, int bufferSize, Preference return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, LeastCommonMultiple::s_functionHelper.name()); } -Expression LeastCommonMultipleNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return LeastCommonMultiple(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression LeastCommonMultipleNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return LeastCommonMultiple(this).shallowReduce(context, angleUnit); } template @@ -53,7 +53,7 @@ Evaluation LeastCommonMultipleNode::templatedApproximate(Context& context, Pr return Complex(product/a); } -Expression LeastCommonMultiple::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression LeastCommonMultiple::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/logarithm.cpp b/poincare/src/logarithm.cpp index b950bded5..0328df7f4 100644 --- a/poincare/src/logarithm.cpp +++ b/poincare/src/logarithm.cpp @@ -48,13 +48,13 @@ int LogarithmNode::serialize(char * buffer, int bufferSize, Preferences::Prin } template<> -Expression LogarithmNode<1>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return CommonLogarithm(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression LogarithmNode<1>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return CommonLogarithm(this).shallowReduce(context, angleUnit); } template<> -Expression LogarithmNode<2>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Logarithm(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression LogarithmNode<2>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Logarithm(this).shallowReduce(context, angleUnit); } template<> @@ -85,7 +85,7 @@ template Evaluation LogarithmNode<2>::templatedApproximate(Contex return Complex(result); } -Expression CommonLogarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols){ +Expression CommonLogarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit){ { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { @@ -102,10 +102,10 @@ Expression CommonLogarithm::shallowReduce(Context & context, Preferences::AngleU #endif Logarithm log = Logarithm::Builder(childAtIndex(0), Rational(10)); replaceWithInPlace(log); - return log.shallowReduce(context, angleUnit, replaceSymbols); + return log.shallowReduce(context, angleUnit); } -Expression Logarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols){ +Expression Logarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit){ { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/matrix.cpp b/poincare/src/matrix.cpp index aa0ee845a..6d291e102 100644 --- a/poincare/src/matrix.cpp +++ b/poincare/src/matrix.cpp @@ -161,7 +161,7 @@ int Matrix::ArrayInverse(T * array, int numberOfRows, int numberOfColumns) { Matrix Matrix::rowCanonize(Context & context, Preferences::AngleUnit angleUnit, Multiplication determinant) { // The matrix children have to be reduced to be able to spot 0 - reduceChildren(context, angleUnit, true); + reduceChildren(context, angleUnit); int m = numberOfRows(); int n = numberOfColumns(); diff --git a/poincare/src/matrix_dimension.cpp b/poincare/src/matrix_dimension.cpp index d540e5ce3..78b0a5f9a 100644 --- a/poincare/src/matrix_dimension.cpp +++ b/poincare/src/matrix_dimension.cpp @@ -11,8 +11,8 @@ constexpr Expression::FunctionHelper MatrixDimension::s_functionHelper; int MatrixDimensionNode::numberOfChildren() const { return MatrixDimension::s_functionHelper.numberOfChildren(); } -Expression MatrixDimensionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return MatrixDimension(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression MatrixDimensionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return MatrixDimension(this).shallowReduce(context, angleUnit); } Layout MatrixDimensionNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -37,7 +37,7 @@ Evaluation MatrixDimensionNode::templatedApproximate(Context& context, Prefer return MatrixComplex(operands, 1, 2); } -Expression MatrixDimension::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression MatrixDimension::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/matrix_inverse.cpp b/poincare/src/matrix_inverse.cpp index de324d17e..fb52b9ce5 100644 --- a/poincare/src/matrix_inverse.cpp +++ b/poincare/src/matrix_inverse.cpp @@ -14,8 +14,8 @@ constexpr Expression::FunctionHelper MatrixInverse::s_functionHelper; int MatrixInverseNode::numberOfChildren() const { return MatrixInverse::s_functionHelper.numberOfChildren(); } -Expression MatrixInverseNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return MatrixInverse(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression MatrixInverseNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return MatrixInverse(this).shallowReduce(context, angleUnit); } Layout MatrixInverseNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -42,7 +42,7 @@ Evaluation MatrixInverseNode::templatedApproximate(Context& context, Preferen return inverse; } -Expression MatrixInverse::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression MatrixInverse::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/matrix_trace.cpp b/poincare/src/matrix_trace.cpp index 1fe868692..cb17d5f02 100644 --- a/poincare/src/matrix_trace.cpp +++ b/poincare/src/matrix_trace.cpp @@ -13,8 +13,8 @@ constexpr Expression::FunctionHelper MatrixTrace::s_functionHelper; int MatrixTraceNode::numberOfChildren() const { return MatrixTrace::s_functionHelper.numberOfChildren(); } -Expression MatrixTraceNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return MatrixTrace(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression MatrixTraceNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return MatrixTrace(this).shallowReduce(context, angleUnit); } Layout MatrixTraceNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -32,7 +32,7 @@ Evaluation MatrixTraceNode::templatedApproximate(Context& context, Preference return result; } -Expression MatrixTrace::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression MatrixTrace::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/matrix_transpose.cpp b/poincare/src/matrix_transpose.cpp index f227ee652..af33f0b81 100644 --- a/poincare/src/matrix_transpose.cpp +++ b/poincare/src/matrix_transpose.cpp @@ -12,8 +12,8 @@ constexpr Expression::FunctionHelper MatrixTranspose::s_functionHelper; int MatrixTransposeNode::numberOfChildren() const { return MatrixTranspose::s_functionHelper.numberOfChildren(); } -Expression MatrixTransposeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return MatrixTranspose(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression MatrixTransposeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return MatrixTranspose(this).shallowReduce(context, angleUnit); } Layout MatrixTransposeNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -37,7 +37,7 @@ Evaluation MatrixTransposeNode::templatedApproximate(Context& context, Prefer return transpose; } -Expression MatrixTranspose::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression MatrixTranspose::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/multiplication.cpp b/poincare/src/multiplication.cpp index 9a24b06ab..009e4cd70 100644 --- a/poincare/src/multiplication.cpp +++ b/poincare/src/multiplication.cpp @@ -90,8 +90,8 @@ int MultiplicationNode::serialize(char * buffer, int bufferSize, Preferences::Pr return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, multiplicationString); } -Expression MultiplicationNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Multiplication(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression MultiplicationNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Multiplication(this).shallowReduce(context, angleUnit); } Expression MultiplicationNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -129,7 +129,7 @@ Expression Multiplication::setSign(ExpressionNode::Sign s, Context & context, Pr return shallowReduce(context, angleUnit); } -Expression Multiplication::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Multiplication::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { return privateShallowReduce(context, angleUnit, true, true); } diff --git a/poincare/src/naperian_logarithm.cpp b/poincare/src/naperian_logarithm.cpp index 9d92c1a7b..1f84fb7ea 100644 --- a/poincare/src/naperian_logarithm.cpp +++ b/poincare/src/naperian_logarithm.cpp @@ -18,11 +18,11 @@ int NaperianLogarithmNode::serialize(char * buffer, int bufferSize, Preferences: return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, NaperianLogarithm::s_functionHelper.name()); } -Expression NaperianLogarithmNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return NaperianLogarithm(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression NaperianLogarithmNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return NaperianLogarithm(this).shallowReduce(context, angleUnit); } -Expression NaperianLogarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression NaperianLogarithm::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/nth_root.cpp b/poincare/src/nth_root.cpp index 72a9d641b..ff5b91a14 100644 --- a/poincare/src/nth_root.cpp +++ b/poincare/src/nth_root.cpp @@ -24,8 +24,8 @@ int NthRootNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloa return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, NthRoot::s_functionHelper.name()); } -Expression NthRootNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return NthRoot(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression NthRootNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return NthRoot(this).shallowReduce(context, angleUnit); } template @@ -43,7 +43,7 @@ Evaluation NthRootNode::templatedApproximate(Context& context, Preferences::A return result; } -Expression NthRoot::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression NthRoot::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/opposite.cpp b/poincare/src/opposite.cpp index 709b65a1d..ac829e0db 100644 --- a/poincare/src/opposite.cpp +++ b/poincare/src/opposite.cpp @@ -60,15 +60,15 @@ int OppositeNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return numberOfChar; } -Expression OppositeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Opposite(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression OppositeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Opposite(this).shallowReduce(context, angleUnit); } /* Simplification */ Opposite::Opposite() : Expression(TreePool::sharedPool()->createTreeNode()) {} -Expression Opposite::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Opposite::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression result = Expression::defaultShallowReduce(context, angleUnit); if (result.isUndefined()) { return result; diff --git a/poincare/src/parenthesis.cpp b/poincare/src/parenthesis.cpp index 7b3f64092..0a7e5aacb 100644 --- a/poincare/src/parenthesis.cpp +++ b/poincare/src/parenthesis.cpp @@ -16,8 +16,8 @@ int ParenthesisNode::serialize(char * buffer, int bufferSize, Preferences::Print return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ""); } -Expression ParenthesisNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Parenthesis(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression ParenthesisNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Parenthesis(this).shallowReduce(context, angleUnit); } template @@ -25,7 +25,7 @@ Evaluation ParenthesisNode::templatedApproximate(Context& context, Preference return childAtIndex(0)->approximate(T(), context, angleUnit); } -Expression Parenthesis::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Parenthesis::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { return e; diff --git a/poincare/src/permute_coefficient.cpp b/poincare/src/permute_coefficient.cpp index 105219f8c..0ebbab457 100644 --- a/poincare/src/permute_coefficient.cpp +++ b/poincare/src/permute_coefficient.cpp @@ -23,8 +23,8 @@ int PermuteCoefficientNode::serialize(char * buffer, int bufferSize, Preferences return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, PermuteCoefficient::s_functionHelper.name()); } -Expression PermuteCoefficientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return PermuteCoefficient(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression PermuteCoefficientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return PermuteCoefficient(this).shallowReduce(context, angleUnit); } template @@ -49,7 +49,7 @@ Evaluation PermuteCoefficientNode::templatedApproximate(Context& context, Pre return Complex(std::round(result)); } -Expression PermuteCoefficient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression PermuteCoefficient::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/power.cpp b/poincare/src/power.cpp index ec1c0bcac..44043aa35 100644 --- a/poincare/src/power.cpp +++ b/poincare/src/power.cpp @@ -140,8 +140,8 @@ int PowerNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatM // Simplify -Expression PowerNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Power(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression PowerNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Power(this).shallowReduce(context, angleUnit); } Expression PowerNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -253,7 +253,7 @@ int Power::getPolynomialCoefficients(Context & context, const char * symbolName, return -1; } -Expression Power::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Power::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); diff --git a/poincare/src/prediction_interval.cpp b/poincare/src/prediction_interval.cpp index b512d2126..81d95d549 100644 --- a/poincare/src/prediction_interval.cpp +++ b/poincare/src/prediction_interval.cpp @@ -27,8 +27,8 @@ int PredictionIntervalNode::serialize(char * buffer, int bufferSize, Preferences } -Expression PredictionIntervalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return PredictionInterval(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression PredictionIntervalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return PredictionInterval(this).shallowReduce(context, angleUnit); } template @@ -46,7 +46,7 @@ Evaluation PredictionIntervalNode::templatedApproximate(Context& context, Pre return MatrixComplex(operands, 1, 2); } -Expression PredictionInterval::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression PredictionInterval::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { @@ -102,7 +102,7 @@ Expression PredictionInterval::shallowReduce(Context & context, Preferences::Ang matrix.addChildAtIndexInPlace(Addition(r0.clone(), m), 1, 1); matrix.setDimensions(1, 2); replaceWithInPlace(matrix); - matrix.deepReduceChildren(context, angleUnit, replaceSymbols); + matrix.deepReduceChildren(context, angleUnit); return matrix; } diff --git a/poincare/src/rational.cpp b/poincare/src/rational.cpp index 52b96eefb..8ab7ff96c 100644 --- a/poincare/src/rational.cpp +++ b/poincare/src/rational.cpp @@ -143,8 +143,8 @@ int RationalNode::simplificationOrderSameType(const ExpressionNode * e, bool can // Simplification -Expression RationalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Rational(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression RationalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Rational(this).shallowReduce(context, angleUnit); } Expression RationalNode::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) { @@ -233,7 +233,7 @@ Rational::Rational(const native_uint_t * i, uint8_t numeratorSize, const native_ static_cast(node())->setDigits(i, numeratorSize, j, denominatorSize, negative); } -Expression Rational::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Rational::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { // FIXME: /* Infinite Rational should not exist as they aren't parsed and are supposed * to be turn in Float if they should appear. We assert(false) so far, but diff --git a/poincare/src/real_part.cpp b/poincare/src/real_part.cpp index 38f98a3db..f4dddfa0c 100644 --- a/poincare/src/real_part.cpp +++ b/poincare/src/real_part.cpp @@ -19,11 +19,11 @@ int RealPartNode::serialize(char * buffer, int bufferSize, Preferences::PrintFlo return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, RealPart::s_functionHelper.name()); } -Expression RealPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return RealPart(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression RealPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return RealPart(this).shallowReduce(context, angleUnit); } -Expression RealPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression RealPart::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/round.cpp b/poincare/src/round.cpp index 537c7fe99..d0cb804da 100644 --- a/poincare/src/round.cpp +++ b/poincare/src/round.cpp @@ -21,8 +21,8 @@ int RoundNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatM return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Round::s_functionHelper.name()); } -Expression RoundNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Round(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression RoundNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Round(this).shallowReduce(context, angleUnit); } template @@ -38,7 +38,7 @@ Evaluation RoundNode::templatedApproximate(Context& context, Preferences::Ang return Complex(std::round(f1*err)/err); } -Expression Round::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Round::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/sine.cpp b/poincare/src/sine.cpp index 27235d162..d831362bc 100644 --- a/poincare/src/sine.cpp +++ b/poincare/src/sine.cpp @@ -30,11 +30,11 @@ int SineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMo return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Sine::s_functionHelper.name()); } -Expression SineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Sine(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression SineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Sine(this).shallowReduce(context, angleUnit); } -Expression Sine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Sine::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/square_root.cpp b/poincare/src/square_root.cpp index ee0485d18..b9413767d 100644 --- a/poincare/src/square_root.cpp +++ b/poincare/src/square_root.cpp @@ -34,11 +34,11 @@ Complex SquareRootNode::computeOnComplex(const std::complex c, Preferences return Complex(ApproximationHelper::TruncateRealOrImaginaryPartAccordingToArgument(result)); } -Expression SquareRootNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return SquareRoot(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression SquareRootNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return SquareRoot(this).shallowReduce(context, angleUnit); } -Expression SquareRoot::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression SquareRoot::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { diff --git a/poincare/src/store.cpp b/poincare/src/store.cpp index c8a2108ff..8df6ce967 100644 --- a/poincare/src/store.cpp +++ b/poincare/src/store.cpp @@ -15,16 +15,16 @@ extern "C" { namespace Poincare { -void StoreNode::reduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +void StoreNode::reduceChildren(Context & context, Preferences::AngleUnit angleUnit) { return; } -void StoreNode::deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +void StoreNode::deepReduceChildren(Context & context, Preferences::AngleUnit angleUnit) { return; } -Expression StoreNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Store(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression StoreNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Store(this).shallowReduce(context, angleUnit); } int StoreNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { @@ -54,7 +54,7 @@ Evaluation StoreNode::templatedApproximate(Context& context, Preferences::Ang return e.approximateToEvaluation(context, angleUnit); } -Expression Store::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Store::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression finalValue; if (symbol().type() == ExpressionNode::Type::Function) { // In tata + 2 ->f(tata), replace tata with xUnknown symbol diff --git a/poincare/src/subtraction.cpp b/poincare/src/subtraction.cpp index f370964e7..0f20117bc 100644 --- a/poincare/src/subtraction.cpp +++ b/poincare/src/subtraction.cpp @@ -52,13 +52,13 @@ template MatrixComplex SubtractionNode::computeOnComplexAndMatrix return result; } -Expression SubtractionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Subtraction(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression SubtractionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Subtraction(this).shallowReduce(context, angleUnit); } Subtraction::Subtraction() : Expression(TreePool::sharedPool()->createTreeNode()) {} -Expression Subtraction::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Subtraction::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) { return e; diff --git a/poincare/src/symbol.cpp b/poincare/src/symbol.cpp index 687303da2..7bdaa8935 100644 --- a/poincare/src/symbol.cpp +++ b/poincare/src/symbol.cpp @@ -116,8 +116,8 @@ int SymbolNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloat return strlcpy(buffer, m_name, bufferSize); } -Expression SymbolNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Symbol(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression SymbolNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Symbol(this).shallowReduce(context, angleUnit); } Expression SymbolNode::shallowReplaceReplaceableSymbols(Context & context) { @@ -156,10 +156,7 @@ bool Symbol::isRegressionSymbol(const char * c) { return false; } -Expression Symbol::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - if (!replaceSymbols) { - return *this; - } +Expression Symbol::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { Symbol s = *this; Expression result = SymbolAbstract::Expand(s, context, true); if (result.isUninitialized()) { diff --git a/poincare/src/tangent.cpp b/poincare/src/tangent.cpp index dd756b427..532b72efc 100644 --- a/poincare/src/tangent.cpp +++ b/poincare/src/tangent.cpp @@ -33,11 +33,11 @@ Complex TangentNode::computeOnComplex(const std::complex c, Preferences::A return Complex(Trigonometry::RoundToMeaningfulDigits(res, angleInput)); } -Expression TangentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - return Tangent(this).shallowReduce(context, angleUnit, replaceSymbols); +Expression TangentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { + return Tangent(this).shallowReduce(context, angleUnit); } -Expression Tangent::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { +Expression Tangent::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) { { Expression e = Expression::defaultShallowReduce(context, angleUnit); if (e.isUndefined()) {