Average Error: 58.7 → 0.4
Time: 15.1s
Precision: 64
\[-0.00017 \lt x\]
\[e^{x} - 1\]
\[\left(x + \left(x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right) \cdot \frac{1}{2}\]
e^{x} - 1
\left(x + \left(x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right) \cdot \frac{1}{2}
double f(double x) {
        double r3420136 = x;
        double r3420137 = exp(r3420136);
        double r3420138 = 1.0;
        double r3420139 = r3420137 - r3420138;
        return r3420139;
}

double f(double x) {
        double r3420140 = x;
        double r3420141 = 0.16666666666666666;
        double r3420142 = r3420140 * r3420141;
        double r3420143 = r3420140 * r3420140;
        double r3420144 = r3420142 * r3420143;
        double r3420145 = r3420140 + r3420144;
        double r3420146 = 0.5;
        double r3420147 = r3420143 * r3420146;
        double r3420148 = r3420145 + r3420147;
        return r3420148;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 58.7

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

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

    \[\leadsto \color{blue}{x + \left(x \cdot x\right) \cdot \left(x \cdot \frac{1}{6} + \frac{1}{2}\right)}\]
  4. Using strategy rm
  5. Applied distribute-rgt-in0.4

    \[\leadsto x + \color{blue}{\left(\left(x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right) + \frac{1}{2} \cdot \left(x \cdot x\right)\right)}\]
  6. Applied associate-+r+0.4

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

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

Reproduce

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

  :herbie-target
  (* x (+ (+ 1 (/ x 2)) (/ (* x x) 6)))

  (- (exp x) 1))