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

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 29.4

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

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

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

    \[\leadsto \color{blue}{(\left({x}^{6}\right) \cdot \frac{1}{360} + \left((\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*\right))_*}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.7

    \[\leadsto (\left({x}^{6}\right) \cdot \frac{1}{360} + \color{blue}{\left(\sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*} \cdot \sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*}\right)})_*\]
  7. Using strategy rm
  8. Applied pow10.7

    \[\leadsto (\left({x}^{6}\right) \cdot \frac{1}{360} + \left(\sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*} \cdot \color{blue}{{\left(\sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*}\right)}^{1}}\right))_*\]
  9. Applied pow10.7

    \[\leadsto (\left({x}^{6}\right) \cdot \frac{1}{360} + \left(\color{blue}{{\left(\sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*}\right)}^{1}} \cdot {\left(\sqrt{(\left({x}^{4}\right) \cdot \frac{1}{12} + \left(x \cdot x\right))_*}\right)}^{1}\right))_*\]
  10. Applied pow-prod-down0.7

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

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

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

Reproduce

herbie shell --seed 2019089 +o rules:numerics
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

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

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