Average Error: 57.9 → 0.6
Time: 10.5s
Precision: 64
\[e^{x} - e^{-x}\]
\[\frac{1}{60} \cdot {x}^{5} + \left(x \cdot \left(\frac{1}{3} \cdot x\right) + 2\right) \cdot x\]
e^{x} - e^{-x}
\frac{1}{60} \cdot {x}^{5} + \left(x \cdot \left(\frac{1}{3} \cdot x\right) + 2\right) \cdot x
double f(double x) {
        double r19290989 = x;
        double r19290990 = exp(r19290989);
        double r19290991 = -r19290989;
        double r19290992 = exp(r19290991);
        double r19290993 = r19290990 - r19290992;
        return r19290993;
}

double f(double x) {
        double r19290994 = 0.016666666666666666;
        double r19290995 = x;
        double r19290996 = 5.0;
        double r19290997 = pow(r19290995, r19290996);
        double r19290998 = r19290994 * r19290997;
        double r19290999 = 0.3333333333333333;
        double r19291000 = r19290999 * r19290995;
        double r19291001 = r19290995 * r19291000;
        double r19291002 = 2.0;
        double r19291003 = r19291001 + r19291002;
        double r19291004 = r19291003 * r19290995;
        double r19291005 = r19290998 + r19291004;
        return r19291005;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 57.9

    \[e^{x} - e^{-x}\]
  2. Taylor expanded around 0 0.6

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

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

    \[\leadsto \frac{1}{60} \cdot {x}^{5} + \left(x \cdot \left(\frac{1}{3} \cdot x\right) + 2\right) \cdot x\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "exp(x)-exp(-x)"
  (- (exp x) (exp (- x))))