Average Error: 30.1 → 0.6
Time: 4.1s
Precision: binary64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{\frac{1}{12} \cdot {x}^{4} + \left(x \cdot x + \frac{1}{360} \cdot {x}^{6}\right)} \cdot \sqrt{\frac{1}{12} \cdot {x}^{4} + \left(x \cdot x + \frac{1}{360} \cdot {x}^{6}\right)}\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 30.1

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Taylor expanded around 0 0.6

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020179 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"
  :precision binary64

  :herbie-target
  (* 4.0 (pow (sinh (/ x 2.0)) 2.0))

  (+ (- (exp x) 2.0) (exp (neg x))))