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




Bits error versus a




Bits error versus x
Results
| Original | 29.9 |
|---|---|
| Target | 0.2 |
| Herbie | 3.2 |
if (* a x) < -0.0033982172708032611Initial program 0.0
if -0.0033982172708032611 < (* a x) Initial program 44.6
Taylor expanded around 0 14.4
Simplified7.5
Taylor expanded around 0 8.1
Simplified4.8
Final simplification3.2
herbie shell --seed 2020198
(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))