\left(e^{x} - 2\right) + e^{-x}
\mathsf{fma}\left(0.002777777777777778, {x}^{6}, \mathsf{fma}\left(x, x, {x}^{4} \cdot 0.08333333333333333\right)\right)
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
(FPCore (x) :precision binary64 (fma 0.002777777777777778 (pow x 6.0) (fma x x (* (pow x 4.0) 0.08333333333333333))))
double code(double x) {
return (exp(x) - 2.0) + exp(-x);
}
double code(double x) {
return fma(0.002777777777777778, pow(x, 6.0), fma(x, x, (pow(x, 4.0) * 0.08333333333333333)));
}




Bits error versus x
| Original | 29.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
Initial program 29.6
Taylor expanded in x around 0 0.5
Simplified0.5
Applied add-cube-cbrt_binary641.3
Taylor expanded in x around 0 0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2022024
(FPCore (x)
:name "exp2 (problem 3.3.7)"
:precision binary64
:herbie-target
(* 4.0 (pow (sinh (/ x 2.0)) 2.0))
(+ (- (exp x) 2.0) (exp (- x))))