e^{x} - 1\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \frac{1}{6}, \frac{1}{2}\right), x\right)\right)\right)double f(double x) {
double r83097 = x;
double r83098 = exp(r83097);
double r83099 = 1.0;
double r83100 = r83098 - r83099;
return r83100;
}
double f(double x) {
double r83101 = x;
double r83102 = 0.16666666666666666;
double r83103 = 0.5;
double r83104 = fma(r83101, r83102, r83103);
double r83105 = r83101 * r83104;
double r83106 = fma(r83101, r83105, r83101);
double r83107 = expm1(r83106);
double r83108 = log1p(r83107);
return r83108;
}




Bits error versus x
| Original | 58.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
Initial program 58.8
Taylor expanded around 0 0.3
Simplified0.3
rmApplied log1p-expm1-u0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020047 +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))