e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.0016860671913569562:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {\left(x \cdot a\right)}^{2}, \mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, a \cdot x\right)\right)\\
\end{array}double code(double a, double x) {
return (exp((a * x)) - 1.0);
}
double code(double a, double x) {
double VAR;
if (((a * x) <= -0.0016860671913569562)) {
VAR = log(exp((exp((a * x)) - 1.0)));
} else {
VAR = fma(0.5, pow((x * a), 2.0), fma(0.16666666666666666, pow((x * a), 3.0), (a * x)));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.0016860671913569562Initial program 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.0016860671913569562 < (* a x) Initial program 44.0
Taylor expanded around 0 14.1
Simplified14.1
rmApplied pow-prod-down7.8
Simplified7.8
rmApplied pow-prod-down0.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2020079 +o rules:numerics
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))
(- (exp (* a x)) 1))