e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.00016544489414043292:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + a \cdot \left(x \cdot \left(a \cdot \left(x \cdot 0.5\right)\right)\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)) <= -0.00016544489414043292)) {
VAR = ((double) (((double) exp(((double) (a * x)))) - 1.0));
} else {
VAR = ((double) (((double) (a * x)) + ((double) (a * ((double) (x * ((double) (a * ((double) (x * 0.5))))))))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.1 |
| Herbie | 0.4 |
if (* a x) < -1.6544489414043292e-4Initial program 0.0
if -1.6544489414043292e-4 < (* a x) Initial program 44.4
Taylor expanded around 0 14.8
Simplified7.8
Taylor expanded around 0 8.5
Simplified4.7
rmApplied associate-*r*0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020199
(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))