Average Error: 30.3 → 0.5
Time: 4.6s
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 r88240 = x;
        double r88241 = exp(r88240);
        double r88242 = 2.0;
        double r88243 = r88241 - r88242;
        double r88244 = -r88240;
        double r88245 = exp(r88244);
        double r88246 = r88243 + r88245;
        return r88246;
}

double f(double x) {
        double r88247 = x;
        double r88248 = 2.0;
        double r88249 = pow(r88247, r88248);
        double r88250 = 0.002777777777777778;
        double r88251 = 6.0;
        double r88252 = pow(r88247, r88251);
        double r88253 = r88250 * r88252;
        double r88254 = r88249 + r88253;
        double r88255 = 0.08333333333333333;
        double r88256 = 4.0;
        double r88257 = pow(r88247, r88256);
        double r88258 = r88255 * r88257;
        double r88259 = r88254 + r88258;
        return r88259;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 30.3

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Taylor expanded around 0 0.5

    \[\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.5

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

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

Reproduce

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

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

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