e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -6.5550761816499685 \cdot 10^{-09}:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a + x \cdot \left(\left(a \cdot a\right) \cdot \left(0.5 + a \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x) :precision binary64 (if (<= (* a x) -6.5550761816499685e-09) (log (exp (- (exp (* a x)) 1.0))) (* x (+ a (* x (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666)))))))))
double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -6.5550761816499685e-09) {
tmp = log(exp(exp(a * x) - 1.0));
} else {
tmp = x * (a + (x * ((a * a) * (0.5 + (a * (x * 0.16666666666666666))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.2 |
| Herbie | 3.0 |
if (*.f64 a x) < -6.5550761816499685e-9Initial program 0.3
rmApplied add-log-exp_binary64_14610.3
Applied add-log-exp_binary64_14610.3
Applied diff-log_binary64_15140.3
Simplified0.3
if -6.5550761816499685e-9 < (*.f64 a x) Initial program 44.7
Taylor expanded around 0 14.0
Simplified7.4
Taylor expanded around 0 7.4
Simplified4.5
Final simplification3.0
herbie shell --seed 2020281
(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))