Average Error: 29.3 → 0.9
Time: 36.7s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \log \left(e^{\frac{1}{12} \cdot {x}^{4}}\right)\right)\]
\left(e^{x} - 2\right) + e^{-x}
{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \log \left(e^{\frac{1}{12} \cdot {x}^{4}}\right)\right)
double f(double x) {
        double r78422 = x;
        double r78423 = exp(r78422);
        double r78424 = 2.0;
        double r78425 = r78423 - r78424;
        double r78426 = -r78422;
        double r78427 = exp(r78426);
        double r78428 = r78425 + r78427;
        return r78428;
}

double f(double x) {
        double r78429 = x;
        double r78430 = 2.0;
        double r78431 = pow(r78429, r78430);
        double r78432 = 0.002777777777777778;
        double r78433 = 6.0;
        double r78434 = pow(r78429, r78433);
        double r78435 = r78432 * r78434;
        double r78436 = 0.08333333333333333;
        double r78437 = 4.0;
        double r78438 = pow(r78429, r78437);
        double r78439 = r78436 * r78438;
        double r78440 = exp(r78439);
        double r78441 = log(r78440);
        double r78442 = r78435 + r78441;
        double r78443 = r78431 + r78442;
        return r78443;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.3

    \[\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 add-log-exp0.9

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

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

Reproduce

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

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

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