mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 07:10:40 +01:00
[poincare] New static Name() method in Expression subclasses
Replaces the name() method in ExpressionNode subclasses. When necessary, the createLayout and serialize methods in thoses subclasses were moved to their .cpp file.
This commit is contained in:
committed by
Émilie Feral
parent
a859b69939
commit
23c07e02ca
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -37,9 +35,7 @@ public:
|
||||
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "abs");
|
||||
}
|
||||
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;
|
||||
@@ -53,6 +49,8 @@ public:
|
||||
explicit AbsoluteValue(Expression operand) : AbsoluteValue() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "abs"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
private:
|
||||
Expression setSign(ExpressionNode::Sign s, Context & context, Preferences::AngleUnit angleUnit);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef POINCARE_ABSOLUTE_VALUE_LAYOUT_NODE_H
|
||||
#define POINCARE_ABSOLUTE_VALUE_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/absolute_value.h>
|
||||
#include <poincare/bracket_pair_layout.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
@@ -12,7 +13,7 @@ public:
|
||||
|
||||
// SerializationHelperInterface
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "abs");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, AbsoluteValue::Name());
|
||||
}
|
||||
|
||||
// TreeNode
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
#define POINCARE_ADDITION_H
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/n_ary_expression_node.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -41,10 +39,7 @@ private:
|
||||
// Layout
|
||||
bool childNeedsParenthesis(const TreeNode * child) const override;
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
static const char * name() { return "+"; }
|
||||
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;
|
||||
@@ -78,6 +73,7 @@ public:
|
||||
addChildAtIndexInPlace(children[i], i, i);
|
||||
}
|
||||
}
|
||||
static const char * Name() { return "+"; }
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -25,12 +24,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const {
|
||||
return "acos";
|
||||
}
|
||||
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;
|
||||
@@ -51,6 +45,7 @@ public:
|
||||
explicit ArcCosine(Expression operand) : ArcCosine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "acos"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -25,10 +24,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "asin"; }
|
||||
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;
|
||||
//Evaluation
|
||||
@@ -48,6 +44,7 @@ public:
|
||||
explicit ArcSine(Expression operand) : ArcSine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "asin"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -25,10 +24,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "atan"; }
|
||||
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;
|
||||
//Evaluation
|
||||
@@ -48,6 +44,7 @@ public:
|
||||
explicit ArcTangent(Expression operand) : ArcTangent() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "atan"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -44,6 +43,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "binomial"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "ceil"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -44,6 +43,7 @@ public:
|
||||
explicit Ceiling(Expression operand) : Ceiling() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "ceil"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef POINCARE_CEILING_LAYOUT_NODE_H
|
||||
#define POINCARE_CEILING_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/ceiling.h>
|
||||
#include <poincare/bracket_pair_layout.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
@@ -12,7 +13,7 @@ public:
|
||||
using BracketPairLayoutNode::BracketPairLayoutNode;
|
||||
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "ceil");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Ceiling::Name());
|
||||
}
|
||||
|
||||
// TreeNode
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; const char * name() const { return "arg"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
explicit ComplexArgument(Expression operand) : ComplexArgument() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "arg"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef POINCARE_CONDENSED_SUM_LAYOUT_NODE_H
|
||||
#define POINCARE_CONDENSED_SUM_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/sum.h>
|
||||
#include <poincare/layout_cursor.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/layout.h>
|
||||
@@ -19,7 +20,7 @@ public:
|
||||
void moveCursorUp(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited = false) override { assert(false); }
|
||||
void moveCursorDown(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited = false) override { assert(false); }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "sum");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Sum::Name());
|
||||
}
|
||||
|
||||
LayoutNode * layoutToPointWhenInserting() override {
|
||||
|
||||
@@ -26,7 +26,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
virtual const char * name() const { return "confidence"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -38,7 +37,8 @@ private:
|
||||
class SimplePredictionIntervalNode final : public ConfidenceIntervalNode {
|
||||
public:
|
||||
private:
|
||||
const char * name() const override { return "prediction"; }
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
};
|
||||
|
||||
class ConfidenceInterval : public Expression {
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "confidence"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
@@ -64,6 +65,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "prediction"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
explicit Conjugate(Expression operand) : Conjugate() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "conj"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -29,10 +28,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "cos"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -51,6 +47,7 @@ public:
|
||||
explicit Cosine(Expression operand) : Cosine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "cos"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define POINCARE_DERIVATIVE_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/variable_context.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -26,13 +24,8 @@ public:
|
||||
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "diff"; }
|
||||
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;
|
||||
@@ -59,6 +52,7 @@ public:
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
replaceChildAtIndexInPlace(2, child3);
|
||||
}
|
||||
static const char * Name() { return "diff"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef POINCARE_DETERMINANT_H
|
||||
#define POINCARE_DETERMINANT_H
|
||||
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -23,10 +22,7 @@ private:
|
||||
/* Layout */
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
/* Serialization */
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "det"; }
|
||||
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;
|
||||
/* Approximation */
|
||||
@@ -43,6 +39,7 @@ public:
|
||||
explicit Determinant(Expression operand) : Determinant() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "det"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -44,9 +43,7 @@ public:
|
||||
// Layout
|
||||
bool childNeedsParenthesis(const TreeNode * child) const override;
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "/");
|
||||
}
|
||||
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;
|
||||
@@ -68,6 +65,8 @@ public:
|
||||
replaceChildAtIndexInPlace(1, denominator);
|
||||
}
|
||||
Division(const DivisionNode * n) : Expression(n) {}
|
||||
static const char * Name() { return "/"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "quo"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -40,6 +39,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "quo"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "rem"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -41,6 +40,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "rem"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef POINCARE_FACTOR_H
|
||||
#define POINCARE_FACTOR_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/multiplication.h>
|
||||
@@ -25,10 +23,7 @@ private:
|
||||
/* Layout */
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
/* Serialization */
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "factor"; }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
/* Simplification */
|
||||
Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override;
|
||||
/* Evaluation */
|
||||
@@ -46,6 +41,7 @@ public:
|
||||
explicit Factor(Expression operand) : Factor() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "factor"; }
|
||||
|
||||
Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit);
|
||||
Multiplication createMultiplicationOfIntegerPrimeDecomposition(Integer i, Context & context, Preferences::AngleUnit angleUnit) const;
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "floor"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -44,6 +43,7 @@ public:
|
||||
explicit Floor(Expression operand) : Floor() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "floor"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define POINCARE_FLOOR_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/bracket_pair_layout.h>
|
||||
#include <poincare/floor.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
@@ -11,7 +12,7 @@ class FloorLayoutNode final : public BracketPairLayoutNode {
|
||||
public:
|
||||
using BracketPairLayoutNode::BracketPairLayoutNode;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "floor");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Floor::Name());
|
||||
}
|
||||
|
||||
// TreeNode
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "frac"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -44,6 +43,7 @@ public:
|
||||
explicit FracPart(Expression operand) : FracPart() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "frac"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "gcd"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -40,6 +39,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "gcd"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicArcCosine; }
|
||||
private:
|
||||
const char * name() const override { return "acosh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicArcCosine(Expression operand) : HyperbolicArcCosine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "acosh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicArcSine; }
|
||||
private:
|
||||
const char * name() const override { return "asinh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicArcSine(Expression operand) : HyperbolicArcSine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "asinh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicArcTangent; }
|
||||
private:
|
||||
const char * name() const override { return "atanh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicArcTangent(Expression operand) : HyperbolicArcTangent() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "atanh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicCosine; }
|
||||
private:
|
||||
const char * name() const override { return "cosh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicCosine(Expression operand) : HyperbolicCosine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "cosh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicSine; }
|
||||
private:
|
||||
const char * name() const override { return "sinh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicSine(Expression operand) : HyperbolicSine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "sinh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ public:
|
||||
// Properties
|
||||
Type type() const override { return Type::HyperbolicTangent; }
|
||||
private:
|
||||
const char * name() const override { return "tanh"; }
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
@@ -38,6 +40,7 @@ public:
|
||||
explicit HyperbolicTangent(Expression operand) : HyperbolicTangent() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "tanh"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define POINCARE_HYPERBOLIC_TRIGONOMETRIC_FUNCTION_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -12,12 +11,6 @@ public:
|
||||
// TreeNode
|
||||
int numberOfChildren() const override { return 1; }
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
virtual const char * name() const = 0;
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override; const char * name() const { return "im"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
explicit ImaginaryPart(Expression operand) : ImaginaryPart() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "im"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
replaceChildAtIndexInPlace(2, child3);
|
||||
replaceChildAtIndexInPlace(3, child4);
|
||||
}
|
||||
static const char * Name() { return "int"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef POINCARE_LEAST_COMMON_MULTIPLE_H
|
||||
#define POINCARE_LEAST_COMMON_MULTIPLE_H
|
||||
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -22,10 +21,7 @@ public:
|
||||
private:
|
||||
/* Layout */
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "lcm"; }
|
||||
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;
|
||||
/* Evaluation */
|
||||
@@ -42,6 +38,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "lcm"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <poincare/integer.h>
|
||||
#include <poincare/addition.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -27,9 +25,7 @@ public:
|
||||
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "log");
|
||||
}
|
||||
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 shallowBeautify(Context & context, Preferences::AngleUnit angleUnit) override;
|
||||
@@ -56,6 +52,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "log"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
Expression shallowBeautify(Context & context, Preferences::AngleUnit angleUnit);
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "dim"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -39,6 +38,8 @@ public:
|
||||
explicit MatrixDimension(Expression operand) : MatrixDimension() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "dim"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "inverse"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -39,6 +38,7 @@ public:
|
||||
explicit MatrixInverse(Expression operand) : MatrixInverse() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "inverse"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "trace"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -39,6 +38,8 @@ public:
|
||||
explicit MatrixTrace(Expression operand) : MatrixTrace() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "trace"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
const char * name() const { return "transpose"; }
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
// Evaluation
|
||||
@@ -39,6 +38,8 @@ public:
|
||||
explicit MatrixTranspose(Expression operand) : MatrixTranspose() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "transpose"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -24,13 +22,8 @@ public:
|
||||
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
static const char * name() { return "ln"; }
|
||||
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;
|
||||
/* Evaluation */
|
||||
@@ -55,6 +48,7 @@ public:
|
||||
explicit NaperianLogarithm(Expression operand) : NaperianLogarithm() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "ln"; }
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define POINCARE_NTH_ROOT_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -24,9 +22,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "root");
|
||||
}
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -44,6 +40,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "root"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define POINCARE_PARENTHESIS_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef POINCARE_PERMUTE_COEFFICIENT_H
|
||||
#define POINCARE_PERMUTE_COEFFICIENT_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/evaluation.h>
|
||||
|
||||
@@ -27,10 +25,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "permute"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -47,6 +42,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "permute"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/multiplication.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -40,10 +39,7 @@ private:
|
||||
|
||||
// Serialize
|
||||
bool childNeedsParenthesis(const TreeNode * child) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
static const char * name() { return "^"; }
|
||||
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;
|
||||
@@ -69,6 +65,7 @@ class Power final : public Expression {
|
||||
public:
|
||||
Power(Expression base, Expression exponent);
|
||||
Power(const PowerNode * n) : Expression(n) {}
|
||||
static const char * Name() { return "^"; }
|
||||
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);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef POINCARE_PREDICTION_INTERVAL_H
|
||||
#define POINCARE_PREDICTION_INTERVAL_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -27,10 +25,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "prediction95"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -47,6 +42,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "prediction95"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -17,9 +17,9 @@ public:
|
||||
|
||||
Type type() const override { return Type::Product; }
|
||||
private:
|
||||
const char * name() const override { return "product"; }
|
||||
float emptySequenceValue() const override { return 1.0f; }
|
||||
Layout createSequenceLayout(Layout argumentLayout, Layout symbolLayout, Layout subscriptLayout, Layout superscriptLayout) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
Evaluation<double> evaluateWithNextTerm(DoublePrecision p, Evaluation<double> a, Evaluation<double> b) const override {
|
||||
return templatedApproximateWithNextTerm<double>(a, b);
|
||||
}
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
replaceChildAtIndexInPlace(2, operand2);
|
||||
replaceChildAtIndexInPlace(3, operand3);
|
||||
}
|
||||
static const char * Name() { return "product"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef POINCARE_RANDINT_H
|
||||
#define POINCARE_RANDINT_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -24,10 +22,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "randint"; }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
// Evaluation
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
return templateApproximate<float>(context, angleUnit);
|
||||
@@ -43,6 +38,7 @@ friend class RandintNode;
|
||||
public:
|
||||
Randint();
|
||||
Randint(const RandintNode * n) : Expression(n) {}
|
||||
static const char * Name() { return "randint"; }
|
||||
template<typename T> static T random();
|
||||
};
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/evaluation.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -27,10 +25,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "random"; }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
// Evaluation
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override {
|
||||
return templateApproximate<float>();
|
||||
@@ -46,6 +41,7 @@ friend class RandomNode;
|
||||
public:
|
||||
Random();
|
||||
Random(const RandomNode * n) : Expression(n) {}
|
||||
static const char * Name() { return "random"; }
|
||||
|
||||
template<typename T> static T random();
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef POINCARE_REEL_PART_H
|
||||
#define POINCARE_REEL_PART_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/approximation_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -25,10 +23,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "re"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -50,6 +45,7 @@ public:
|
||||
explicit RealPart(Expression operand) : RealPart() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "re"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#ifndef POINCARE_ROUND_H
|
||||
#define POINCARE_ROUND_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/evaluation.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -25,10 +23,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "round"; }
|
||||
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;
|
||||
// Evaluation
|
||||
@@ -45,6 +40,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, operand0);
|
||||
replaceChildAtIndexInPlace(1, operand1);
|
||||
}
|
||||
static const char * Name() { return "round"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef POINCARE_SEQUENCE_H
|
||||
#define POINCARE_SEQUENCE_H
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/approximation_helper.h>
|
||||
|
||||
@@ -13,11 +11,7 @@ public:
|
||||
int numberOfChildren() const override { return 4; }
|
||||
private:
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
virtual Layout createSequenceLayout(Layout argumentLayout, Layout symbolLayout, Layout subscriptLayout, Layout superscriptLayout) const = 0;
|
||||
virtual const char * name() const = 0;
|
||||
/* Approximation */
|
||||
Evaluation<float> approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate<float>(context, angleUnit); }
|
||||
Evaluation<double> approximate(DoublePrecision p, Context& context, Preferences::AngleUnit angleUnit) const override { return templatedApproximate<double>(context, angleUnit); }
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -29,10 +28,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "sin"; }
|
||||
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;
|
||||
@@ -53,6 +49,7 @@ public:
|
||||
explicit Sine(Expression operand) : Sine() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "sin"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <ion/charset.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -45,11 +45,14 @@ public:
|
||||
explicit SquareRoot(Expression operand) : Expression(TreePool::sharedPool()->createTreeNode<SquareRootNode>()) {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() {
|
||||
constexpr static char k_name[2] = {Ion::Charset::Root, 0};
|
||||
return k_name;
|
||||
}
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/symbol_abstract.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/evaluation.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -43,7 +42,6 @@ public:
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true) override;
|
||||
|
||||
private:
|
||||
static const char * name() { return "-"; }
|
||||
/* Evaluation */
|
||||
template<typename T> static MatrixComplex<T> computeOnMatrixAndComplex(const MatrixComplex<T> m, const std::complex<T> c) {
|
||||
return ApproximationHelper::ElementWiseOnMatrixComplexAndComplex(m, c, compute<T>);
|
||||
@@ -62,6 +60,7 @@ public:
|
||||
replaceChildAtIndexInPlace(0, child1);
|
||||
replaceChildAtIndexInPlace(1, child2);
|
||||
}
|
||||
static const char * Name() { return "-"; }
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
|
||||
@@ -17,9 +17,9 @@ public:
|
||||
|
||||
Type type() const override { return Type::Sum; }
|
||||
private:
|
||||
const char * name() const override { return "sum"; }
|
||||
float emptySequenceValue() const override { return 0.0f; }
|
||||
Layout createSequenceLayout(Layout argumentLayout, Layout symbolLayout, Layout subscriptLayout, Layout superscriptLayout) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
Evaluation<double> evaluateWithNextTerm(DoublePrecision p, Evaluation<double> a, Evaluation<double> b) const override {
|
||||
return templatedApproximateWithNextTerm<double>(a, b);
|
||||
}
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
replaceChildAtIndexInPlace(2, operand2);
|
||||
replaceChildAtIndexInPlace(3, operand3);
|
||||
}
|
||||
static const char * Name() { return "sum"; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <poincare/approximation_helper.h>
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -26,10 +25,7 @@ public:
|
||||
private:
|
||||
// Layout
|
||||
Layout createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
const char * name() const { return "tan"; }
|
||||
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;
|
||||
@@ -51,6 +47,7 @@ public:
|
||||
explicit Tangent(Expression operand) : Tangent() {
|
||||
replaceChildAtIndexInPlace(0, operand);
|
||||
}
|
||||
static const char * Name() { return "tan"; }
|
||||
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols = true);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <poincare/absolute_value.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <poincare/absolute_value_layout.h>
|
||||
#include <assert.h>
|
||||
@@ -14,6 +16,10 @@ Layout AbsoluteValueNode::createLayout(Preferences::PrintFloatMode floatDisplayM
|
||||
return AbsoluteValueLayout(childAtIndex(0)->createLayout(floatDisplayMode, numberOfSignificantDigits));
|
||||
}
|
||||
|
||||
int AbsoluteValueNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, AbsoluteValue::Name());
|
||||
}
|
||||
|
||||
Expression AbsoluteValueNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return AbsoluteValue(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <poincare/opposite.h>
|
||||
#include <poincare/undefined.h>
|
||||
//#include <poincare/matrix.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -36,7 +38,11 @@ bool AdditionNode::childNeedsParenthesis(const TreeNode * child) const {
|
||||
}
|
||||
|
||||
Layout AdditionNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Infix(Addition(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Infix(Addition(this), floatDisplayMode, numberOfSignificantDigits, Addition::Name());
|
||||
}
|
||||
|
||||
int AdditionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Addition::Name());
|
||||
}
|
||||
|
||||
// Simplication
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include <poincare/arc_cosine.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout ArcCosineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ArcCosine(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ArcCosine(this), floatDisplayMode, numberOfSignificantDigits, ArcCosine::Name());
|
||||
}
|
||||
|
||||
int ArcCosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ArcCosine::Name());
|
||||
}
|
||||
|
||||
Expression ArcCosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include <poincare/arc_sine.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout ArcSineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ArcSine(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ArcSine(this), floatDisplayMode, numberOfSignificantDigits, ArcSine::Name());
|
||||
}
|
||||
|
||||
int ArcSineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ArcSine::Name());
|
||||
}
|
||||
|
||||
Expression ArcSineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include <poincare/arc_tangent.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout ArcTangentNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ArcTangent(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ArcTangent(this), floatDisplayMode, numberOfSignificantDigits, ArcTangent::Name());
|
||||
}
|
||||
|
||||
int ArcTangentNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ArcTangent::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <poincare/binomial_coefficient.h>
|
||||
#include <poincare/binomial_coefficient_layout.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <stdlib.h>
|
||||
@@ -20,7 +21,7 @@ Layout BinomialCoefficientNode::createLayout(Preferences::PrintFloatMode floatDi
|
||||
}
|
||||
|
||||
int BinomialCoefficientNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "binomial");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, BinomialCoefficient::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <poincare/binomial_coefficient.h>
|
||||
#include <poincare/binomial_coefficient_layout.h>
|
||||
#include <poincare/left_parenthesis_layout.h>
|
||||
#include <poincare/right_parenthesis_layout.h>
|
||||
@@ -73,7 +74,7 @@ void BinomialCoefficientLayoutNode::moveCursorDown(LayoutCursor * cursor, bool *
|
||||
}
|
||||
|
||||
int BinomialCoefficientLayoutNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "binomial");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, BinomialCoefficient::Name());
|
||||
}
|
||||
|
||||
KDSize BinomialCoefficientLayoutNode::computeSize() {
|
||||
|
||||
@@ -16,7 +16,7 @@ Layout CeilingNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, i
|
||||
}
|
||||
|
||||
int CeilingNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Ceiling::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -10,11 +10,11 @@ extern "C" {
|
||||
namespace Poincare {
|
||||
|
||||
Layout ComplexArgumentNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ComplexArgument(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ComplexArgument(this), floatDisplayMode, numberOfSignificantDigits, ComplexArgument::Name());
|
||||
}
|
||||
|
||||
int ComplexArgumentNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ComplexArgument::Name());
|
||||
}
|
||||
|
||||
Expression ComplexArgumentNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <poincare/confidence_interval.h>
|
||||
#include <poincare/addition.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/matrix.h>
|
||||
#include <poincare/multiplication.h>
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <cmath>
|
||||
@@ -12,11 +12,11 @@
|
||||
namespace Poincare {
|
||||
|
||||
Layout ConfidenceIntervalNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ConfidenceInterval(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ConfidenceInterval(this), floatDisplayMode, numberOfSignificantDigits, ConfidenceInterval::Name());
|
||||
}
|
||||
|
||||
int ConfidenceIntervalNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ConfidenceInterval::Name());
|
||||
}
|
||||
|
||||
Expression ConfidenceIntervalNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
@@ -38,6 +38,14 @@ Evaluation<T> ConfidenceIntervalNode::templatedApproximate(Context& context, Pre
|
||||
return MatrixComplex<T>(operands, 1, 2);
|
||||
}
|
||||
|
||||
Layout SimplePredictionIntervalNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(SimplePredictionInterval(this), floatDisplayMode, numberOfSignificantDigits, SimplePredictionInterval::Name());
|
||||
}
|
||||
|
||||
int SimplePredictionIntervalNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, SimplePredictionInterval::Name());
|
||||
}
|
||||
|
||||
ConfidenceInterval::ConfidenceInterval() : Expression(TreePool::sharedPool()->createTreeNode<ConfidenceIntervalNode>()) {}
|
||||
|
||||
Expression ConfidenceInterval::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -12,7 +12,7 @@ Layout ConjugateNode::createLayout(Preferences::PrintFloatMode floatDisplayMode,
|
||||
}
|
||||
|
||||
int ConjugateNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "conj");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Conjugate::Name());
|
||||
}
|
||||
|
||||
Expression ConjugateNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <poincare/conjugate.h>
|
||||
#include <poincare/conjugate_layout.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
@@ -51,7 +52,7 @@ void ConjugateLayoutNode::moveCursorRight(LayoutCursor * cursor, bool * shouldRe
|
||||
}
|
||||
|
||||
int ConjugateLayoutNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "conj");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Conjugate::Name());
|
||||
}
|
||||
|
||||
KDSize ConjugateLayoutNode::computeSize() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <poincare/cosine.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -18,7 +19,11 @@ Complex<T> CosineNode::computeOnComplex(const std::complex<T> c, Preferences::An
|
||||
}
|
||||
|
||||
Layout CosineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(Cosine(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(Cosine(this), floatDisplayMode, numberOfSignificantDigits, Cosine::Name());
|
||||
}
|
||||
|
||||
int CosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Cosine::Name());
|
||||
}
|
||||
|
||||
Expression CosineNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <poincare/derivative.h>
|
||||
#include <poincare/symbol.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <cmath>
|
||||
@@ -20,6 +22,14 @@ int DerivativeNode::polynomialDegree(Context & context, const char * symbolName)
|
||||
return ExpressionNode::polynomialDegree(context, symbolName);
|
||||
}
|
||||
|
||||
Layout DerivativeNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, Derivative::Name());
|
||||
}
|
||||
|
||||
int DerivativeNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Derivative::Name());
|
||||
}
|
||||
|
||||
Expression DerivativeNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return Derivative(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <poincare/determinant.h>
|
||||
#include <poincare/matrix.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
@@ -9,7 +10,11 @@ extern "C" {
|
||||
namespace Poincare {
|
||||
|
||||
Layout DeterminantNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(Determinant(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(Determinant(this), floatDisplayMode, numberOfSignificantDigits, Determinant::Name());
|
||||
}
|
||||
|
||||
int DeterminantNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Determinant::Name());
|
||||
}
|
||||
|
||||
// TODO: handle this exactly in shallowReduce for small dimensions.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <poincare/opposite.h>
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -35,6 +36,10 @@ Layout DivisionNode::createLayout(Preferences::PrintFloatMode floatDisplayMode,
|
||||
return FractionLayout(numerator->createLayout(floatDisplayMode, numberOfSignificantDigits), denominator->createLayout(floatDisplayMode, numberOfSignificantDigits));
|
||||
}
|
||||
|
||||
int DivisionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Infix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Division::Name());
|
||||
}
|
||||
|
||||
Expression DivisionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return Division(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ Expression DivisionQuotientNode::shallowReduce(Context & context, Preferences::A
|
||||
}
|
||||
|
||||
Layout DivisionQuotientNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(DivisionQuotient(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(DivisionQuotient(this), floatDisplayMode, numberOfSignificantDigits, DivisionQuotient::Name());
|
||||
}
|
||||
int DivisionQuotientNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, DivisionQuotient::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
namespace Poincare {
|
||||
|
||||
Layout DivisionRemainderNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(DivisionRemainder(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(DivisionRemainder(this), floatDisplayMode, numberOfSignificantDigits, DivisionRemainder::Name());
|
||||
}
|
||||
|
||||
int DivisionRemainderNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, DivisionRemainder::Name());
|
||||
}
|
||||
|
||||
Expression DivisionRemainderNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <poincare/subtraction.h>
|
||||
#include <poincare/symbol.h>
|
||||
#include <poincare/char_layout.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/horizontal_layout.h>
|
||||
#include <ion.h>
|
||||
extern "C" {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/division.h>
|
||||
#include <poincare/opposite.h>
|
||||
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
extern "C" {
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@@ -14,7 +15,11 @@ extern "C" {
|
||||
namespace Poincare {
|
||||
|
||||
Layout FactorNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(Factor(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(Factor(this), floatDisplayMode, numberOfSignificantDigits, Factor::Name());
|
||||
}
|
||||
|
||||
int FactorNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Factor::Name());
|
||||
}
|
||||
|
||||
Factor::Factor() : Expression(TreePool::sharedPool()->createTreeNode<FactorNode>()) {}
|
||||
|
||||
@@ -16,7 +16,7 @@ Layout FloorNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int
|
||||
}
|
||||
|
||||
int FloorNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Floor::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
namespace Poincare {
|
||||
|
||||
Layout FracPartNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(FracPart(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(FracPart(this), floatDisplayMode, numberOfSignificantDigits, FracPart::Name());
|
||||
}
|
||||
|
||||
int FracPartNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, FracPart::Name());
|
||||
}
|
||||
|
||||
Expression FracPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
namespace Poincare {
|
||||
|
||||
Layout GreatCommonDivisorNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(GreatCommonDivisor(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(GreatCommonDivisor(this), floatDisplayMode, numberOfSignificantDigits, GreatCommonDivisor::Name());
|
||||
}
|
||||
|
||||
int GreatCommonDivisorNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, GreatCommonDivisor::Name());
|
||||
}
|
||||
|
||||
Expression GreatCommonDivisorNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
#include <poincare/hyperbolic_arc_cosine.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicArcCosineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicArcCosine(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicArcCosine::Name());
|
||||
}
|
||||
|
||||
int HyperbolicArcCosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicArcCosine::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicArcCosineNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
std::complex<T> result = std::acosh(c);
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
#include <poincare/hyperbolic_arc_sine.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicArcSineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicArcSine(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicArcSine::Name());
|
||||
}
|
||||
int HyperbolicArcSineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicArcSine::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicArcSineNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
std::complex<T> result = std::asinh(c);
|
||||
@@ -21,5 +30,4 @@ Complex<T> HyperbolicArcSineNode::computeOnComplex(const std::complex<T> c, Pref
|
||||
template Complex<float> Poincare::HyperbolicArcSineNode::computeOnComplex<float>(std::complex<float>, Preferences::AngleUnit);
|
||||
template Complex<double> Poincare::HyperbolicArcSineNode::computeOnComplex<double>(std::complex<double>, Preferences::AngleUnit);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
#include <poincare/hyperbolic_arc_tangent.h>
|
||||
#include <poincare/complex.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicArcTangentNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicArcTangent(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicArcTangent::Name());
|
||||
}
|
||||
|
||||
int HyperbolicArcTangentNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicArcTangent::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicArcTangentNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
std::complex<T> result = std::atanh(c);
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
#include <poincare/hyperbolic_cosine.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicCosineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicCosine(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicCosine::Name());
|
||||
}
|
||||
int HyperbolicCosineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicCosine::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicCosineNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
return Complex<T>(Trigonometry::RoundToMeaningfulDigits(std::cosh(c), c));
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
#include <poincare/hyperbolic_sine.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicSineNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicSine(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicSine::Name());
|
||||
}
|
||||
int HyperbolicSineNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicSine::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicSineNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
return Complex<T>(Trigonometry::RoundToMeaningfulDigits(std::sinh(c), c));
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
#include <poincare/hyperbolic_tangent.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicTangentNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicTangent(this), floatDisplayMode, numberOfSignificantDigits, HyperbolicTangent::Name());
|
||||
}
|
||||
int HyperbolicTangentNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, HyperbolicTangent::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Complex<T> HyperbolicTangentNode::computeOnComplex(const std::complex<T> c, Preferences::AngleUnit angleUnit) {
|
||||
return Complex<T>(Trigonometry::RoundToMeaningfulDigits(std::tanh(c), c));
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
#include <poincare/hyperbolic_trigonometric_function.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout HyperbolicTrigonometricFunctionNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(HyperbolicTrigonometricFunction(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
}
|
||||
|
||||
Expression HyperbolicTrigonometricFunctionNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return HyperbolicTrigonometricFunction(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
namespace Poincare {
|
||||
|
||||
Layout ImaginaryPartNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(ImaginaryPart(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(ImaginaryPart(this), floatDisplayMode, numberOfSignificantDigits, ImaginaryPart::Name());
|
||||
}
|
||||
|
||||
int ImaginaryPartNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, ImaginaryPart::Name());
|
||||
}
|
||||
|
||||
Expression ImaginaryPartNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -31,7 +31,7 @@ Layout IntegralNode::createLayout(Preferences::PrintFloatMode floatDisplayMode,
|
||||
}
|
||||
|
||||
int IntegralNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "int");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Integral::Name());
|
||||
}
|
||||
|
||||
Expression IntegralNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -3,13 +3,18 @@
|
||||
#include <poincare/undefined.h>
|
||||
#include <poincare/arithmetic.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout LeastCommonMultipleNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(LeastCommonMultiple(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(LeastCommonMultiple(this), floatDisplayMode, numberOfSignificantDigits, LeastCommonMultiple::Name());
|
||||
}
|
||||
|
||||
int LeastCommonMultipleNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, LeastCommonMultiple::Name());
|
||||
}
|
||||
|
||||
Expression LeastCommonMultipleNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <poincare/naperian_logarithm.h>
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <poincare/constant.h>
|
||||
#include <poincare/undefined.h>
|
||||
@@ -20,7 +22,7 @@ namespace Poincare {
|
||||
|
||||
template<>
|
||||
Layout LogarithmNode<1>::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, "log");
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, Logarithm::Name());
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -30,6 +32,11 @@ Layout LogarithmNode<2>::createLayout(Preferences::PrintFloatMode floatDisplayMo
|
||||
childAtIndex(1)->createLayout(floatDisplayMode, numberOfSignificantDigits));
|
||||
}
|
||||
|
||||
template<int T>
|
||||
int LogarithmNode<T>::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, Logarithm::Name());
|
||||
}
|
||||
|
||||
template<int T>
|
||||
Expression LogarithmNode<T>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return Logarithm(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
@@ -302,6 +309,8 @@ template Evaluation<float> LogarithmNode<1>::templatedApproximate<float>(Poincar
|
||||
template Evaluation<double> LogarithmNode<1>::templatedApproximate<double>(Poincare::Context&, Poincare::Preferences::AngleUnit) const;
|
||||
template Evaluation<float> LogarithmNode<2>::templatedApproximate<float>(Poincare::Context&, Poincare::Preferences::AngleUnit) const;
|
||||
template Evaluation<double> LogarithmNode<2>::templatedApproximate<double>(Poincare::Context&, Poincare::Preferences::AngleUnit) const;
|
||||
template int LogarithmNode<1>::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const;
|
||||
template int LogarithmNode<2>::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const;
|
||||
template Expression LogarithmNode<1>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols);
|
||||
template Expression LogarithmNode<2>::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols);
|
||||
template Expression LogarithmNode<1>::shallowBeautify(Context & context, Preferences::AngleUnit angleUnit);
|
||||
|
||||
@@ -12,11 +12,11 @@ Expression MatrixDimensionNode::shallowReduce(Context & context, Preferences::An
|
||||
}
|
||||
|
||||
Layout MatrixDimensionNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(MatrixDimension(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(MatrixDimension(this), floatDisplayMode, numberOfSignificantDigits, MatrixDimension::Name());
|
||||
}
|
||||
|
||||
int MatrixDimensionNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, MatrixDimension::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -15,11 +15,11 @@ Expression MatrixInverseNode::shallowReduce(Context & context, Preferences::Angl
|
||||
}
|
||||
|
||||
Layout MatrixInverseNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(MatrixInverse(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(MatrixInverse(this), floatDisplayMode, numberOfSignificantDigits, MatrixInverse::Name());
|
||||
}
|
||||
|
||||
int MatrixInverseNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, MatrixInverse::Name());
|
||||
}
|
||||
|
||||
// TODO: handle this exactly in shallowReduce for small dimensions.
|
||||
|
||||
@@ -14,11 +14,11 @@ Expression MatrixTraceNode::shallowReduce(Context & context, Preferences::AngleU
|
||||
}
|
||||
|
||||
Layout MatrixTraceNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(MatrixTrace(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(MatrixTrace(this), floatDisplayMode, numberOfSignificantDigits, MatrixTrace::Name());
|
||||
}
|
||||
|
||||
int MatrixTraceNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, MatrixTrace::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -12,11 +12,11 @@ Expression MatrixTransposeNode::shallowReduce(Context & context, Preferences::An
|
||||
}
|
||||
|
||||
Layout MatrixTransposeNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(MatrixTranspose(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(MatrixTranspose(this), floatDisplayMode, numberOfSignificantDigits, MatrixTranspose::Name());
|
||||
}
|
||||
|
||||
int MatrixTransposeNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, MatrixTranspose::Name());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
#include <poincare/naperian_logarithm.h>
|
||||
#include <poincare/constant.h>
|
||||
#include <poincare/logarithm.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/simplification_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Layout NaperianLogarithmNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(this, floatDisplayMode, numberOfSignificantDigits, NaperianLogarithm::Name());
|
||||
}
|
||||
int NaperianLogarithmNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, NaperianLogarithm::Name());
|
||||
}
|
||||
|
||||
Expression NaperianLogarithmNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return NaperianLogarithm(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <poincare/power.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <poincare/nth_root_layout.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -14,6 +16,10 @@ Layout NthRootNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, i
|
||||
childAtIndex(1)->createLayout(floatDisplayMode, numberOfSignificantDigits));
|
||||
}
|
||||
|
||||
int NthRootNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, NthRoot::Name());
|
||||
}
|
||||
|
||||
Expression NthRootNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
return NthRoot(this).shallowReduce(context, angleUnit, replaceSymbols);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <poincare/nth_root.h>
|
||||
#include <poincare/nth_root_layout.h>
|
||||
#include <poincare/square_root.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <ion/charset.h>
|
||||
@@ -146,18 +148,17 @@ void NthRootLayoutNode::deleteBeforeCursor(LayoutCursor * cursor) {
|
||||
LayoutNode::deleteBeforeCursor(cursor);
|
||||
}
|
||||
|
||||
static_assert('\x91' == Ion::Charset::Root, "Unicode error");
|
||||
int NthRootLayoutNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
// Case: root(x,n)
|
||||
if (m_hasIndex
|
||||
&& (const_cast<NthRootLayoutNode *>(this))->indexLayout()
|
||||
&& !(const_cast<NthRootLayoutNode *>(this))->indexLayout()->isEmpty())
|
||||
{
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "root");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, NthRoot::Name());
|
||||
}
|
||||
// Case: squareRoot(x)
|
||||
if (!m_hasIndex) {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "\x91");
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, SquareRoot::Name());
|
||||
}
|
||||
// Case: root(x,empty)
|
||||
// Write "'SquareRootSymbol'('radicandLayout')".
|
||||
@@ -168,7 +169,7 @@ int NthRootLayoutNode::serialize(char * buffer, int bufferSize, Preferences::Pri
|
||||
buffer[bufferSize-1] = 0;
|
||||
int numberOfChar = 0;
|
||||
|
||||
buffer[numberOfChar++] = '\x91';
|
||||
buffer[numberOfChar++] = Ion::Charset::Root;
|
||||
if (numberOfChar >= bufferSize-1) {
|
||||
return bufferSize-1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <poincare/parenthesis.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <poincare/permute_coefficient.h>
|
||||
#include <poincare/undefined.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
@@ -10,7 +12,11 @@ extern "C" {
|
||||
namespace Poincare {
|
||||
|
||||
Layout PermuteCoefficientNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return LayoutHelper::Prefix(PermuteCoefficient(this), floatDisplayMode, numberOfSignificantDigits, name());
|
||||
return LayoutHelper::Prefix(PermuteCoefficient(this), floatDisplayMode, numberOfSignificantDigits, PermuteCoefficient::Name());
|
||||
}
|
||||
|
||||
int PermuteCoefficientNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, PermuteCoefficient::Name());
|
||||
}
|
||||
|
||||
Expression PermuteCoefficientNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user