Average Error: 58.1 → 1.8
Time: 23.5s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
\[x + \left(\left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right) \cdot x + {x}^{5} \cdot \frac{2}{15}\right)\]

Error

Bits error versus x

Derivation

  1. Initial program 58.1

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

    \[\leadsto \color{blue}{\left(x + \frac{2}{15} \cdot {x}^{5}\right) - \frac{1}{3} \cdot {x}^{3}}\]
  3. Simplified1.8

    \[\leadsto \color{blue}{\left({x}^{5} \cdot \frac{2}{15} + x \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right)\right) + x}\]
  4. Final simplification1.8

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

Reproduce

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