Numworks Epsilon  1.4.1
Graphing Calculator Operating System
division.h
Go to the documentation of this file.
1 #ifndef POINCARE_DIVISION_H
2 #define POINCARE_DIVISION_H
3 
7 
8 namespace Poincare {
9 
10 class Division : public StaticHierarchy<2> {
12  friend class Multiplication;
13  friend class Symbol;
14  friend class Power;
15 public:
16  Type type() const override;
17  Expression * clone() const override;
18  template<typename T> static Complex<T> compute(const Complex<T> c, const Complex<T> d);
19  int polynomialDegree(char symbolName) const override;
20 private:
21  /* Layout */
22  bool needParenthesisWithParent(const Expression * e) const override;
23  ExpressionLayout * privateCreateLayout(PrintFloat::Mode floatDisplayMode, ComplexFormat complexFormat) const override;
24  int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override {
25  return LayoutEngine::writeInfixExpressionTextInBuffer(this, buffer, bufferSize, numberOfSignificantDigits, "/");
26  }
27  /* Simplification */
28  Expression * shallowReduce(Context& context, AngleUnit angleUnit) override;
29  /* Evaluation */
30  template<typename T> static Matrix * computeOnMatrixAndComplex(const Matrix * m, const Complex<T> * c) {
32  }
33  template<typename T> static Matrix * computeOnComplexAndMatrix(const Complex<T> * c, const Matrix * n);
34  template<typename T> static Matrix * computeOnMatrices(const Matrix * m, const Matrix * n);
35 
36  virtual Expression * privateApproximate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override {
37  return ApproximationEngine::mapReduce<float>(this, context, angleUnit, compute<float>, computeOnComplexAndMatrix<float>, computeOnMatrixAndComplex<float>, computeOnMatrices<float>);
38  }
39  virtual Expression * privateApproximate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override {
40  return ApproximationEngine::mapReduce<double>(this, context, angleUnit, compute<double>, computeOnComplexAndMatrix<double>, computeOnMatrixAndComplex<double>, computeOnMatrices<double>);
41  }
42 };
43 
44 }
45 
46 #endif
static int writeInfixExpressionTextInBuffer(const Expression *expression, char *buffer, int bufferSize, int numberOfDigits, const char *operatorName)
Type type() const override
Definition: division.cpp:18
int polynomialDegree(char symbolName) const override
Definition: division.cpp:26
static Matrix * elementWiseOnComplexAndComplexMatrix(const Complex< T > *c, const Matrix *n, ComplexAndComplexReduction< T > computeOnComplexes)
c(generic_all_nodes)
static Complex< T > compute(const Complex< T > c, const Complex< T > d)
Definition: division.cpp:52
Expression * clone() const override
Definition: division.cpp:22
friend class Matrix
Definition: expression.h:73