Numworks Epsilon  1.4.1
Graphing Calculator Operating System
cosine.h
Go to the documentation of this file.
1 #ifndef POINCARE_COSINE_H
2 #define POINCARE_COSINE_H
3 
8 #include <poincare/expression.h>
9 
10 namespace Poincare {
11 
14  friend class Tangent;
15 public:
16  Type type() const override;
17  Expression * clone() const override;
18  float characteristicXRange(Context & context, AngleUnit angleUnit = AngleUnit::Default) const override;
19  template<typename T> static Complex<T> computeOnComplex(const Complex<T> c, AngleUnit angleUnit = AngleUnit::Radian);
20 private:
21  /* Layout */
22  ExpressionLayout * privateCreateLayout(PrintFloat::Mode floatDisplayMode, ComplexFormat complexFormat) const override {
23  return LayoutEngine::createPrefixLayout(this, floatDisplayMode, complexFormat, name());
24  }
25  int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override {
26  return LayoutEngine::writePrefixExpressionTextInBuffer(this, buffer, bufferSize, numberOfSignificantDigits, name());
27  }
28  const char * name() const { return "cos"; }
29  /* Simplication */
30  Expression * shallowReduce(Context& context, AngleUnit angleUnit) override;
31  /* Evaluation */
32  Expression * privateApproximate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override {
33  return ApproximationEngine::map<float>(this, context, angleUnit,computeOnComplex<float>);
34  }
35  Expression * privateApproximate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override {
36  return ApproximationEngine::map<double>(this, context, angleUnit, computeOnComplex<double>);
37  }
38 };
39 
40 }
41 
42 #endif
Expression * clone() const override
Definition: cosine.cpp:20
c(generic_all_nodes)
constexpr Poincare::Expression::AngleUnit Radian
Definition: helper.h:4
static ExpressionLayout * createPrefixLayout(const Expression *expression, PrintFloat::Mode floatDisplayMode, Expression::ComplexFormat complexFormat, const char *operatorName)
Type type() const override
Definition: cosine.cpp:16
static Complex< T > computeOnComplex(const Complex< T > c, AngleUnit angleUnit=AngleUnit::Radian)
Definition: cosine.cpp:44
static int writePrefixExpressionTextInBuffer(const Expression *expression, char *buffer, int bufferSize, int numberOfDigits, const char *operatorName)
float characteristicXRange(Context &context, AngleUnit angleUnit=AngleUnit::Default) const override
Definition: cosine.cpp:25