\left(e^{x} - 2\right) + e^{-x}\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{fma}\left(x, x, \mathsf{fma}\left(\frac{1}{12}, {x}^{4}, {x}^{6} \cdot \frac{1}{360}\right)\right)\right)\right)double f(double x) {
double r144887 = x;
double r144888 = exp(r144887);
double r144889 = 2.0;
double r144890 = r144888 - r144889;
double r144891 = -r144887;
double r144892 = exp(r144891);
double r144893 = r144890 + r144892;
return r144893;
}
double f(double x) {
double r144894 = x;
double r144895 = 0.08333333333333333;
double r144896 = 4.0;
double r144897 = pow(r144894, r144896);
double r144898 = 6.0;
double r144899 = pow(r144894, r144898);
double r144900 = 0.002777777777777778;
double r144901 = r144899 * r144900;
double r144902 = fma(r144895, r144897, r144901);
double r144903 = fma(r144894, r144894, r144902);
double r144904 = expm1(r144903);
double r144905 = log1p(r144904);
return r144905;
}




Bits error versus x
| Original | 29.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
Initial program 29.8
Taylor expanded around 0 0.5
Simplified0.5
rmApplied log1p-expm1-u0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2019196 +o rules:numerics
(FPCore (x)
:name "exp2 (problem 3.3.7)"
:herbie-target
(* 4.0 (pow (sinh (/ x 2.0)) 2.0))
(+ (- (exp x) 2.0) (exp (- x))))