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;
}




Bits error versus x
Results
| Original | 58.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
Initial program 58.7
Taylor expanded around 0 0.4
Simplified0.4
rmApplied distribute-rgt-in0.4
Applied associate-+r+0.4
Final simplification0.4
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))