Numworks Epsilon  1.4.1
Graphing Calculator Operating System
opposite.h
Go to the documentation of this file.
1 #ifndef POINCARE_OPPOSITE_H
2 #define POINCARE_OPPOSITE_H
3 
7 
8 namespace Poincare {
9 
10 class Opposite : public StaticHierarchy<1> {
12 public:
13  Expression * clone() const override;
14  Type type() const override;
15  int polynomialDegree(char symbolName) const override;
16  Sign sign() const override;
17  template<typename T> static Complex<T> compute(const Complex<T> c, AngleUnit angleUnit);
18 private:
19  /* Layout */
20  bool needParenthesisWithParent(const Expression * e) const override;
21  ExpressionLayout * privateCreateLayout(PrintFloat::Mode floatDisplayMode, ComplexFormat complexFormat) const override;
22  int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override;
23  /* Simplification */
24  Expression * shallowReduce(Context& context, AngleUnit angleUnit) override;
25  /* Evaluation */
26  Expression * privateApproximate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override {
27  return ApproximationEngine::map<float>(this, context, angleUnit, compute<float>);
28  }
29  Expression * privateApproximate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override {
30  return ApproximationEngine::map<double>(this, context, angleUnit, compute<double>);
31  }
32 };
33 
34 }
35 
36 #endif
Expression * clone() const override
Definition: opposite.cpp:21
int polynomialDegree(char symbolName) const override
Definition: opposite.cpp:26
static Complex< T > compute(const Complex< T > c, AngleUnit angleUnit)
Definition: opposite.cpp:48
c(generic_all_nodes)
Sign sign() const override
Definition: opposite.cpp:30
Type type() const override
Definition: opposite.cpp:17