Average Error: 29.8 → 0.6
Time: 4.7s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}} \cdot \sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}}\]
\left(e^{x} - 2\right) + e^{-x}
\sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}} \cdot \sqrt{\left({x}^{2} + \frac{1}{360} \cdot {x}^{6}\right) + \frac{1}{12} \cdot {x}^{4}}
double f(double x) {
        double r103731 = x;
        double r103732 = exp(r103731);
        double r103733 = 2.0;
        double r103734 = r103732 - r103733;
        double r103735 = -r103731;
        double r103736 = exp(r103735);
        double r103737 = r103734 + r103736;
        return r103737;
}

double f(double x) {
        double r103738 = x;
        double r103739 = 2.0;
        double r103740 = pow(r103738, r103739);
        double r103741 = 0.002777777777777778;
        double r103742 = 6.0;
        double r103743 = pow(r103738, r103742);
        double r103744 = r103741 * r103743;
        double r103745 = r103740 + r103744;
        double r103746 = 0.08333333333333333;
        double r103747 = 4.0;
        double r103748 = pow(r103738, r103747);
        double r103749 = r103746 * r103748;
        double r103750 = r103745 + r103749;
        double r103751 = sqrt(r103750);
        double r103752 = r103751 * r103751;
        return r103752;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.8

    \[\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. Using strategy rm
  6. Applied add-sqr-sqrt0.6

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

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

Reproduce

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

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

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