Average Error: 29.3 → 0.9
Time: 12.3s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[{x}^{2} + \log \left(e^{\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}}\right)\]
\left(e^{x} - 2\right) + e^{-x}
{x}^{2} + \log \left(e^{\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}}\right)
double f(double x) {
        double r128386 = x;
        double r128387 = exp(r128386);
        double r128388 = 2.0;
        double r128389 = r128387 - r128388;
        double r128390 = -r128386;
        double r128391 = exp(r128390);
        double r128392 = r128389 + r128391;
        return r128392;
}

double f(double x) {
        double r128393 = x;
        double r128394 = 2.0;
        double r128395 = pow(r128393, r128394);
        double r128396 = 0.002777777777777778;
        double r128397 = 6.0;
        double r128398 = pow(r128393, r128397);
        double r128399 = r128396 * r128398;
        double r128400 = 0.08333333333333333;
        double r128401 = 4.0;
        double r128402 = pow(r128393, r128401);
        double r128403 = r128400 * r128402;
        double r128404 = r128399 + r128403;
        double r128405 = exp(r128404);
        double r128406 = log(r128405);
        double r128407 = r128395 + r128406;
        return r128407;
}

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

    \[\leadsto {x}^{2} + \left(\color{blue}{\log \left(e^{\frac{1}{360} \cdot {x}^{6}}\right)} + \log \left(e^{\frac{1}{12} \cdot {x}^{4}}\right)\right)\]
  6. Applied sum-log0.9

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

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

    \[\leadsto {x}^{2} + \log \left(e^{\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}}\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))))