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

double f(double x) {
        double r3821559 = x;
        double r3821560 = 0.5;
        double r3821561 = 0.16666666666666666;
        double r3821562 = r3821559 * r3821561;
        double r3821563 = r3821560 + r3821562;
        double r3821564 = r3821559 * r3821559;
        double r3821565 = r3821563 * r3821564;
        double r3821566 = r3821559 + r3821565;
        return r3821566;
}

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 \frac{1}{6} + \frac{1}{2}\right) \cdot \left(x \cdot x\right) + x}\]
  4. Final simplification0.5

    \[\leadsto x + \left(\frac{1}{2} + x \cdot \frac{1}{6}\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))