Average Error: 58.5 → 0.5
Time: 12.1s
Precision: 64
\[-1.700000000000000122124532708767219446599 \cdot 10^{-4} \lt x\]
\[e^{x} - 1\]
\[x + \left(\frac{1}{2} + \frac{1}{6} \cdot x\right) \cdot \left(x \cdot x\right)\]
e^{x} - 1
x + \left(\frac{1}{2} + \frac{1}{6} \cdot x\right) \cdot \left(x \cdot x\right)
double f(double x) {
        double r4471240 = x;
        double r4471241 = exp(r4471240);
        double r4471242 = 1.0;
        double r4471243 = r4471241 - r4471242;
        return r4471243;
}

double f(double x) {
        double r4471244 = x;
        double r4471245 = 0.5;
        double r4471246 = 0.16666666666666666;
        double r4471247 = r4471246 * r4471244;
        double r4471248 = r4471245 + r4471247;
        double r4471249 = r4471244 * r4471244;
        double r4471250 = r4471248 * r4471249;
        double r4471251 = r4471244 + r4471250;
        return r4471251;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original58.5
Target0.5
Herbie0.5
\[x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{x \cdot x}{6}\right)\]

Derivation

  1. Initial program 58.5

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

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

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

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

Reproduce

herbie shell --seed 2019171 
(FPCore (x)
  :name "expm1 (example 3.7)"
  :pre (< -0.00017 x)

  :herbie-target
  (* x (+ (+ 1.0 (/ x 2.0)) (/ (* x x) 6.0)))

  (- (exp x) 1.0))