Average Error: 30.2 → 0.6
Time: 4.4s
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 r205419 = x;
        double r205420 = exp(r205419);
        double r205421 = 2.0;
        double r205422 = r205420 - r205421;
        double r205423 = -r205419;
        double r205424 = exp(r205423);
        double r205425 = r205422 + r205424;
        return r205425;
}

double f(double x) {
        double r205426 = x;
        double r205427 = 2.0;
        double r205428 = pow(r205426, r205427);
        double r205429 = 0.002777777777777778;
        double r205430 = 6.0;
        double r205431 = pow(r205426, r205430);
        double r205432 = r205429 * r205431;
        double r205433 = r205428 + r205432;
        double r205434 = 0.08333333333333333;
        double r205435 = 4.0;
        double r205436 = pow(r205426, r205435);
        double r205437 = r205434 * r205436;
        double r205438 = r205433 + r205437;
        return r205438;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 30.2

    \[\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 2020020 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"
  :precision binary64

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

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