e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -1.97221861134718174 \cdot 10^{-5}:\\
\;\;\;\;\sqrt[3]{{\left(\log \left(e^{e^{a \cdot x} - 1}\right)\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {a}^{2} \cdot {x}^{2}, \mathsf{fma}\left(\frac{1}{6}, {a}^{3} \cdot {x}^{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 temp;
if (((a * x) <= -1.9722186113471817e-05)) {
temp = cbrt(pow(log(exp((exp((a * x)) - 1.0))), 3.0));
} else {
temp = fma(0.5, (pow(a, 2.0) * pow(x, 2.0)), fma(0.16666666666666666, (pow(a, 3.0) * pow(x, 3.0)), (a * x)));
}
return temp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.0 |
|---|---|
| Target | 0.2 |
| Herbie | 9.3 |
if (* a x) < -1.9722186113471817e-05Initial program 0.1
rmApplied add-cbrt-cube0.1
Simplified0.1
rmApplied add-log-exp0.1
Applied add-log-exp0.1
Applied diff-log0.1
Simplified0.1
if -1.9722186113471817e-05 < (* a x) Initial program 44.0
Taylor expanded around 0 14.1
Simplified14.1
Final simplification9.3
herbie shell --seed 2020056 +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))