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