Average Error: 58.1 → 1.8
Time: 23.3s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
\[(\left(x \cdot \left(x \cdot \frac{-1}{3}\right)\right) \cdot x + \left((\frac{2}{15} \cdot \left({x}^{5}\right) + x)_*\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(\left(x \cdot \frac{-1}{3}\right) \cdot x\right) \cdot x + \left((\frac{2}{15} \cdot \left({x}^{5}\right) + x)_*\right))_*}\]
  4. Final simplification1.8

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

Reproduce

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