Average Error: 58.6 → 0.5
Time: 11.4s
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 r4903659 = x;
        double r4903660 = exp(r4903659);
        double r4903661 = 1.0;
        double r4903662 = r4903660 - r4903661;
        return r4903662;
}

double f(double x) {
        double r4903663 = x;
        double r4903664 = 0.5;
        double r4903665 = 0.16666666666666666;
        double r4903666 = r4903665 * r4903663;
        double r4903667 = r4903664 + r4903666;
        double r4903668 = r4903663 * r4903663;
        double r4903669 = r4903667 * r4903668;
        double r4903670 = r4903663 + r4903669;
        return r4903670;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 58.6

    \[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 2019169 
(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))