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




Bits error versus a




Bits error versus x
Results
| Original | 29.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (*.f64 a x) < -5.9848612359912151e-6Initial program 0.1
rmApplied add-log-exp_binary640.1
Applied add-log-exp_binary640.1
Applied diff-log_binary640.1
Simplified0.1
if -5.9848612359912151e-6 < (*.f64 a x) Initial program 44.0
Taylor expanded around 0 13.9
Simplified7.6
Taylor expanded around 0 8.1
Simplified8.1
rmApplied pow2_binary648.1
Applied pow2_binary648.1
Applied pow-prod-down_binary640.6
Final simplification0.4
herbie shell --seed 2020204
(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))