e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -1.9961401647367767 \cdot 10^{-21}:\\
\;\;\;\;\sqrt[3]{{\left(\sqrt[3]{\left(e^{a \cdot x} - 1\right) \cdot \log \left(e^{e^{a \cdot x} - 1}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\sqrt{e^{a \cdot x}}, \sqrt{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.9961401647367767e-21)) {
temp = cbrt(pow((cbrt(((exp((a * x)) - 1.0) * log(exp((exp((a * x)) - 1.0))))) * cbrt(fma(sqrt(exp((a * x))), sqrt(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.3 |
|---|---|
| Target | 0.2 |
| Herbie | 9.0 |
if (* a x) < -1.9961401647367767e-21Initial program 2.0
rmApplied add-cbrt-cube2.0
Simplified2.0
rmApplied add-cube-cbrt2.0
Simplified2.0
rmApplied add-sqr-sqrt2.0
Applied fma-neg2.0
rmApplied add-log-exp2.0
Applied add-log-exp2.0
Applied diff-log2.0
Simplified2.0
if -1.9961401647367767e-21 < (* a x) Initial program 44.5
Taylor expanded around 0 13.0
Simplified13.0
Final simplification9.0
herbie shell --seed 2020057 +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))