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 r87846 = x;
double r87847 = exp(r87846);
double r87848 = 1.0;
double r87849 = r87847 - r87848;
return r87849;
}
double f(double x) {
double r87850 = 0.5;
double r87851 = x;
double r87852 = 2.0;
double r87853 = pow(r87851, r87852);
double r87854 = 0.16666666666666666;
double r87855 = 3.0;
double r87856 = pow(r87851, r87855);
double r87857 = fma(r87854, r87856, r87851);
double r87858 = fma(r87850, r87853, r87857);
return r87858;
}




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