Average Error: 29.7 → 0.7
Time: 6.3s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}\]
\left(e^{x} - 2\right) + e^{-x}
\sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{360} \cdot {x}^{6} + \frac{1}{12} \cdot {x}^{4}\right)}
double f(double x) {
        double r135423 = x;
        double r135424 = exp(r135423);
        double r135425 = 2.0;
        double r135426 = r135424 - r135425;
        double r135427 = -r135423;
        double r135428 = exp(r135427);
        double r135429 = r135426 + r135428;
        return r135429;
}

double f(double x) {
        double r135430 = x;
        double r135431 = 2.0;
        double r135432 = pow(r135430, r135431);
        double r135433 = 0.002777777777777778;
        double r135434 = 6.0;
        double r135435 = pow(r135430, r135434);
        double r135436 = r135433 * r135435;
        double r135437 = 0.08333333333333333;
        double r135438 = 4.0;
        double r135439 = pow(r135430, r135438);
        double r135440 = r135437 * r135439;
        double r135441 = r135436 + r135440;
        double r135442 = r135432 + r135441;
        double r135443 = sqrt(r135442);
        double r135444 = r135443 * r135443;
        return r135444;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.7

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

    \[\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-sqr-sqrt0.7

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

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

Reproduce

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

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

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