Average Error: 29.8 → 0.6
Time: 6.7s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}} \cdot \sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}}\]
\left(e^{x} - 2\right) + e^{-x}
\sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}} \cdot \sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}}
double f(double x) {
        double r427 = x;
        double r428 = exp(r427);
        double r429 = 2.0;
        double r430 = r428 - r429;
        double r431 = -r427;
        double r432 = exp(r431);
        double r433 = r430 + r432;
        return r433;
}

double f(double x) {
        double r434 = x;
        double r435 = 2.0;
        double r436 = pow(r434, r435);
        double r437 = 0.002777777777777778;
        double r438 = 6.0;
        double r439 = pow(r434, r438);
        double r440 = r437 * r439;
        double r441 = r436 + r440;
        double r442 = 0.08333333333333333;
        double r443 = 4.0;
        double r444 = pow(r434, r443);
        double r445 = r442 * r444;
        double r446 = r441 + r445;
        double r447 = sqrt(r446);
        double r448 = r447 * r447;
        return r448;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.8

    \[\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. Using strategy rm
  4. Applied associate-+r+0.6

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

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

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

Reproduce

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

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

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