Numworks Epsilon  1.4.1
Graphing Calculator Operating System
hyperbolic_tangent.cpp
Go to the documentation of this file.
4 #include <poincare/complex.h>
5 #include <poincare/division.h>
7 extern "C" {
8 #include <assert.h>
9 }
10 #include <cmath>
11 
12 namespace Poincare {
13 
16 }
17 
20  return a;
21 }
22 
23 Expression * HyperbolicTangent::shallowReduce(Context& context, AngleUnit angleUnit) {
24  Expression * e = Expression::shallowReduce(context, angleUnit);
25  if (e != this) {
26  return e;
27  }
28 #if MATRIX_EXACT_REDUCING
29  Expression * op = editableOperand(0);
30  if (op->type() == Type::Matrix) {
31  return SimplificationEngine::map(this, context, angleUnit);
32  }
33 #endif
34  return this;
35 }
36 
37 template<typename T>
39  if (c.b() == 0) {
40  return Complex<T>::Float(std::tanh(c.a()));
41  }
44  return Division::compute(arg1, arg2);
45 }
46 
47 }
Expression * clone() const override
c(generic_all_nodes)
Expression * editableOperand(int i)
Definition: expression.h:176
static Complex< T > compute(const Complex< T > c, const Complex< T > d)
Definition: division.cpp:52
static Complex< T > computeOnComplex(const Complex< T > c, AngleUnit angleUnit)
friend class HyperbolicTangent
Definition: expression.h:51
const Expression * m_operands[T]
#define tanh(x)
Definition: math.h:198
static Complex< T > Float(T x)
Definition: complex.cpp:23
static Complex< T > computeOnComplex(const Complex< T > c, AngleUnit angleUnit)
static Complex< T > computeOnComplex(const Complex< T > c, AngleUnit angleUnit)