e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -8268373.4522136636078357696533203125:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, \left|x \cdot a\right| \cdot \left|x \cdot a\right|, \mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, a \cdot x\right)\right)\\
\end{array}double f(double a, double x) {
double r118852 = a;
double r118853 = x;
double r118854 = r118852 * r118853;
double r118855 = exp(r118854);
double r118856 = 1.0;
double r118857 = r118855 - r118856;
return r118857;
}
double f(double a, double x) {
double r118858 = a;
double r118859 = x;
double r118860 = r118858 * r118859;
double r118861 = -8268373.452213664;
bool r118862 = r118860 <= r118861;
double r118863 = exp(r118860);
double r118864 = 1.0;
double r118865 = r118863 - r118864;
double r118866 = 0.5;
double r118867 = r118859 * r118858;
double r118868 = fabs(r118867);
double r118869 = r118868 * r118868;
double r118870 = 0.16666666666666666;
double r118871 = 3.0;
double r118872 = pow(r118867, r118871);
double r118873 = fma(r118870, r118872, r118860);
double r118874 = fma(r118866, r118869, r118873);
double r118875 = r118862 ? r118865 : r118874;
return r118875;
}




Bits error versus a




Bits error versus x
| Original | 29.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.8 |
if (* a x) < -8268373.452213664Initial program 0
if -8268373.452213664 < (* a x) Initial program 43.9
Taylor expanded around 0 15.5
Simplified15.5
rmApplied pow-prod-down8.7
Simplified8.7
rmApplied add-sqr-sqrt8.7
Simplified8.7
Simplified1.2
Final simplification0.8
herbie shell --seed 2019352 +o rules:numerics
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))
(- (exp (* a x)) 1))