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 r98224 = x;
double r98225 = exp(r98224);
double r98226 = 1.0;
double r98227 = r98225 - r98226;
return r98227;
}
double f(double x) {
double r98228 = 0.5;
double r98229 = x;
double r98230 = 2.0;
double r98231 = pow(r98229, r98230);
double r98232 = 0.16666666666666666;
double r98233 = 3.0;
double r98234 = pow(r98229, r98233);
double r98235 = fma(r98232, r98234, r98229);
double r98236 = fma(r98228, r98231, r98235);
return r98236;
}




Bits error versus x
| Original | 58.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
Initial program 58.6
Taylor expanded around 0 0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2020062 +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))