\left(e^{x} - 2\right) + e^{-x}\mathsf{fma}\left(\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{360}\right), \left(x \cdot x\right), \left(\sqrt{\mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{12}, \left(x \cdot x\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right), \frac{1}{12}, \left(x \cdot x\right)\right)}\right)\right)double f(double x) {
double r15700218 = x;
double r15700219 = exp(r15700218);
double r15700220 = 2.0;
double r15700221 = r15700219 - r15700220;
double r15700222 = -r15700218;
double r15700223 = exp(r15700222);
double r15700224 = r15700221 + r15700223;
return r15700224;
}
double f(double x) {
double r15700225 = x;
double r15700226 = r15700225 * r15700225;
double r15700227 = r15700226 * r15700226;
double r15700228 = 0.002777777777777778;
double r15700229 = r15700227 * r15700228;
double r15700230 = 0.08333333333333333;
double r15700231 = fma(r15700227, r15700230, r15700226);
double r15700232 = sqrt(r15700231);
double r15700233 = r15700232 * r15700232;
double r15700234 = fma(r15700229, r15700226, r15700233);
return r15700234;
}




Bits error versus x
| Original | 29.4 |
|---|---|
| Target | 0.0 |
| Herbie | 0.6 |
Initial program 29.4
Taylor expanded around 0 0.6
Simplified0.6
rmApplied add-sqr-sqrt0.6
Final simplification0.6
herbie shell --seed 2019128 +o rules:numerics
(FPCore (x)
:name "exp2 (problem 3.3.7)"
:herbie-target
(* 4 (pow (sinh (/ x 2)) 2))
(+ (- (exp x) 2) (exp (- x))))