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




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.0 |
| Herbie | 0.8 |
Initial program 29.4
Taylor expanded around 0 0.8
Final simplification0.8
herbie shell --seed 2021045
(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))))