e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -4385658.6985369977:\\
\;\;\;\;{e}^{\left(a \cdot x\right)} - 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, \left|x \cdot a\right| \cdot \left|x \cdot a\right|, a \cdot x\right)\\
\end{array}double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double VAR;
if ((((double) (a * x)) <= -4385658.698536998)) {
VAR = ((double) (((double) pow(((double) M_E), ((double) (a * x)))) - 1.0));
} else {
VAR = ((double) fma(0.5, ((double) (((double) fabs(((double) (x * a)))) * ((double) fabs(((double) (x * a)))))), ((double) (a * x))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.2 |
| Herbie | 1.0 |
if (* a x) < -4385658.698536998Initial program 0
rmApplied *-un-lft-identity0
Applied exp-prod0
Simplified0
if -4385658.698536998 < (* a x) Initial program 43.3
Taylor expanded around 0 14.3
Simplified14.3
Taylor expanded around 0 8.5
Simplified8.5
rmApplied add-sqr-sqrt8.5
Simplified8.5
Simplified1.5
Final simplification1.0
herbie shell --seed 2020113 +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))