Average Error: 29.4 → 0.7
Time: 14.4s
Precision: 64
\[\left(e^{x} - 2\right) + e^{-x}\]
\[{x}^{4} \cdot \frac{1}{12} + \left(x \cdot x + \log \left({\left(e^{\frac{1}{360}}\right)}^{\left({x}^{6}\right)}\right)\right)\]
\left(e^{x} - 2\right) + e^{-x}
{x}^{4} \cdot \frac{1}{12} + \left(x \cdot x + \log \left({\left(e^{\frac{1}{360}}\right)}^{\left({x}^{6}\right)}\right)\right)
double f(double x) {
        double r81867 = x;
        double r81868 = exp(r81867);
        double r81869 = 2.0;
        double r81870 = r81868 - r81869;
        double r81871 = -r81867;
        double r81872 = exp(r81871);
        double r81873 = r81870 + r81872;
        return r81873;
}

double f(double x) {
        double r81874 = x;
        double r81875 = 4.0;
        double r81876 = pow(r81874, r81875);
        double r81877 = 0.08333333333333333;
        double r81878 = r81876 * r81877;
        double r81879 = r81874 * r81874;
        double r81880 = 0.002777777777777778;
        double r81881 = exp(r81880);
        double r81882 = 6.0;
        double r81883 = pow(r81874, r81882);
        double r81884 = pow(r81881, r81883);
        double r81885 = log(r81884);
        double r81886 = r81879 + r81885;
        double r81887 = r81878 + r81886;
        return r81887;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.4

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

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

    \[\leadsto \color{blue}{\left({x}^{6} \cdot \frac{1}{360} + x \cdot x\right) + \frac{1}{12} \cdot {x}^{4}}\]
  4. Using strategy rm
  5. Applied add-log-exp0.7

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

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

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

Reproduce

herbie shell --seed 2019179 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

  :herbie-target
  (* 4.0 (pow (sinh (/ x 2.0)) 2.0))

  (+ (- (exp x) 2.0) (exp (- x))))