e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -1.3848736434257956 \cdot 10^{-5}:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + a \cdot \left(x \cdot \left(a \cdot \left(x \cdot \frac{1}{2}\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)) <= -1.3848736434257956e-05)) {
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.2 |
| Herbie | 0.4 |
if (* a x) < -1.3848736434257956e-5Initial program 0.1
if -1.3848736434257956e-5 < (* a x) Initial program 45.1
Taylor expanded around 0 15.4
Simplified8.1
Taylor expanded around 0 8.9
Simplified5.0
rmApplied associate-*r*0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020182
(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))