Blame view

Giac_maj/epsilon-giac/poincare/src/naperian_logarithm.cpp 917 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #include <poincare/naperian_logarithm.h>
  extern "C" {
  #include <assert.h>
  #include <stdlib.h>
  }
  #include <cmath>
  #include "layout/horizontal_layout.h"
  #include "layout/parenthesis_layout.h"
  #include "layout/string_layout.h"
  
  namespace Poincare {
  
  NaperianLogarithm::NaperianLogarithm() :
    Function("ln")
  {
  }
  
  Expression::Type NaperianLogarithm::type() const {
    return Type::NaperianLogarithm;
  }
  
  Expression * NaperianLogarithm::cloneWithDifferentOperands(Expression** newOperands,
          int numberOfOperands, bool cloneOperands) const {
    assert(newOperands != nullptr);
    NaperianLogarithm * l = new NaperianLogarithm();
    l->setArgument(newOperands, numberOfOperands, cloneOperands);
    return l;
  }
  
  template<typename T>
  Complex<T> NaperianLogarithm::templatedComputeComplex(const Complex<T> c) const {
    if (c.b() != 0) {
      return Complex<T>::Float(NAN);
    }
    return Complex<T>::Float(std::log(c.a()));
  }
  
  }