\left(e^{x} - 2\right) + e^{-x}\mathsf{fma}\left(x, x, \mathsf{fma}\left(\frac{1}{360}, {x}^{6}, \frac{1}{12} \cdot {x}^{4}\right)\right)double code(double x) {
return ((exp(x) - 2.0) + exp(-x));
}
double code(double x) {
return fma(x, x, fma(0.002777777777777778, pow(x, 6.0), (0.08333333333333333 * pow(x, 4.0))));
}




Bits error versus x
Results
| Original | 30.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.7 |
Initial program 30.0
Taylor expanded around 0 0.7
Simplified0.7
Final simplification0.7
herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
:name "exp2 (problem 3.3.7)"
:precision binary64
:herbie-target
(* 4 (pow (sinh (/ x 2)) 2))
(+ (- (exp x) 2) (exp (- x))))