Average Error: 29.6 → 0.6
Time: 12.1s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}\]
\left(e^{x} - 2\right) + e^{-x}
\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}
double f(double x) {
        double r96402 = x;
        double r96403 = exp(r96402);
        double r96404 = 2.0;
        double r96405 = r96403 - r96404;
        double r96406 = -r96402;
        double r96407 = exp(r96406);
        double r96408 = r96405 + r96407;
        return r96408;
}

double f(double x) {
        double r96409 = x;
        double r96410 = 2.0;
        double r96411 = pow(r96409, r96410);
        double r96412 = 0.002777777777777778;
        double r96413 = 6.0;
        double r96414 = pow(r96409, r96413);
        double r96415 = r96412 * r96414;
        double r96416 = r96411 + r96415;
        double r96417 = 0.08333333333333333;
        double r96418 = 4.0;
        double r96419 = pow(r96409, r96418);
        double r96420 = r96417 * r96419;
        double r96421 = r96416 + r96420;
        return r96421;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.6

    \[\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. Final simplification0.6

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

Reproduce

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

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

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