Average Error: 29.1 → 0.6
Time: 26.9s
Precision: 64
Internal Precision: 128
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\left(x \cdot x + \frac{1}{12} \cdot {x}^{4}\right) + {x}^{6} \cdot \frac{1}{360}\]

Error

Bits error versus x

Target

Original29.1
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.1

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Simplified29.1

    \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \frac{-1}{e^{x}}}\]
  3. Taylor expanded around 0 0.6

    \[\leadsto \color{blue}{{x}^{2} + \left(\frac{1}{12} \cdot {x}^{4} + \frac{1}{360} \cdot {x}^{6}\right)}\]
  4. Simplified0.6

    \[\leadsto \color{blue}{{x}^{6} \cdot \frac{1}{360} + \left(x \cdot x + \frac{1}{12} \cdot {x}^{4}\right)}\]
  5. Final simplification0.6

    \[\leadsto \left(x \cdot x + \frac{1}{12} \cdot {x}^{4}\right) + {x}^{6} \cdot \frac{1}{360}\]

Reproduce

herbie shell --seed 2019093 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

  :herbie-target
  (* 4 (pow (sinh (/ x 2)) 2))

  (+ (- (exp x) 2) (exp (- x))))