e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -37.800190631006544:\\
\;\;\;\;\frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{e^{x \cdot \left(a + a\right)} + 1 \cdot \left(1 + e^{a \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot a + \frac{\frac{-1}{4} \cdot \left(a \cdot x\right)}{\frac{1}{6} - \frac{\frac{\frac{1}{2}}{a}}{x}}\\
\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)) <= -37.800190631006544)) {
VAR = (((double) (((double) pow(((double) exp(((double) (a * x)))), 3.0)) - ((double) pow(1.0, 3.0)))) / ((double) (((double) exp(((double) (x * ((double) (a + a)))))) + ((double) (1.0 * ((double) (1.0 + ((double) exp(((double) (a * x)))))))))));
} else {
VAR = ((double) (((double) (x * a)) + (((double) (-0.25 * ((double) (a * x)))) / ((double) (0.16666666666666666 - ((0.5 / a) / x))))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (* a x) < -37.800190631006544Initial program 0
rmApplied flip3--0
Simplified0
if -37.800190631006544 < (* a x) Initial program 44.1
Taylor expanded around 0 14.4
Simplified4.7
rmApplied flip-+4.7
Applied associate-*r/4.7
Applied associate-*r/4.7
Simplified0.7
rmApplied distribute-rgt-in0.7
Simplified0.7
Taylor expanded around 0 0.7
Final simplification0.5
herbie shell --seed 2020181
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))