Average Error: 60.1 → 53.0
Time: 20.6s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
\[\left(x + {x}^{5} \cdot \frac{2}{15}\right) - \left(\left({x}^{12} \cdot \frac{1}{648} + \frac{1}{3} \cdot {x}^{3}\right) - \frac{1}{162} \cdot {x}^{9}\right)\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 60.1

    \[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
  2. Taylor expanded around 0 53.0

    \[\leadsto \color{blue}{\left(x + \frac{2}{15} \cdot {x}^{5}\right) - \frac{1}{3} \cdot {x}^{3}}\]
  3. Using strategy rm
  4. Applied add-log-exp53.1

    \[\leadsto \left(x + \frac{2}{15} \cdot {x}^{5}\right) - \color{blue}{\log \left(e^{\frac{1}{3} \cdot {x}^{3}}\right)}\]
  5. Taylor expanded around 0 53.0

    \[\leadsto \left(x + \frac{2}{15} \cdot {x}^{5}\right) - \log \color{blue}{\left(\frac{1}{3} \cdot {x}^{3} + \left(\frac{1}{18} \cdot {x}^{6} + 1\right)\right)}\]
  6. Taylor expanded around 0 53.0

    \[\leadsto \left(x + \frac{2}{15} \cdot {x}^{5}\right) - \color{blue}{\left(\left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{648} \cdot {x}^{12}\right) - \frac{1}{162} \cdot {x}^{9}\right)}\]
  7. Final simplification53.0

    \[\leadsto \left(x + {x}^{5} \cdot \frac{2}{15}\right) - \left(\left({x}^{12} \cdot \frac{1}{648} + \frac{1}{3} \cdot {x}^{3}\right) - \frac{1}{162} \cdot {x}^{9}\right)\]

Runtime

Time bar (total: 20.6s)Debug logProfile

herbie shell --seed 2018255 
(FPCore (x)
  :name "Hyperbolic tangent"
  (/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))