e^{x} - 1\mathsf{fma}\left(\frac{1}{2}, {x}^{2}, \mathsf{fma}\left(\frac{1}{6}, {x}^{3}, x\right)\right)double f(double x) {
double r54291 = x;
double r54292 = exp(r54291);
double r54293 = 1.0;
double r54294 = r54292 - r54293;
return r54294;
}
double f(double x) {
double r54295 = 0.5;
double r54296 = x;
double r54297 = 2.0;
double r54298 = pow(r54296, r54297);
double r54299 = 0.16666666666666666;
double r54300 = 3.0;
double r54301 = pow(r54296, r54300);
double r54302 = fma(r54299, r54301, r54296);
double r54303 = fma(r54295, r54298, r54302);
return r54303;
}




Bits error versus x
| Original | 58.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
Initial program 58.9
Taylor expanded around 0 0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020046 +o rules:numerics
(FPCore (x)
:name "expm1 (example 3.7)"
:precision binary64
:pre (< -0.00017 x)
:herbie-target
(* x (+ (+ 1 (/ x 2)) (/ (* x x) 6)))
(- (exp x) 1))