e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -6.4881712685880057 \cdot 10^{-15}:\\
\;\;\;\;\sqrt[3]{\frac{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}{{\left(\mathsf{fma}\left(1, e^{a \cdot x} + 1, e^{a \cdot x + a \cdot x}\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 VAR;
if (((a * x) <= -6.488171268588006e-15)) {
VAR = cbrt((pow((exp(((a * x) * 3.0)) - pow(1.0, 3.0)), 3.0) / pow(fma(1.0, (exp((a * x)) + 1.0), exp(((a * x) + (a * x)))), 3.0)));
} else {
VAR = 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 VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.8 |
|---|---|
| Target | 0.2 |
| Herbie | 9.3 |
if (* a x) < -6.488171268588006e-15Initial program 0.8
rmApplied add-cbrt-cube0.8
Simplified0.8
rmApplied flip3--0.8
Applied cube-div0.8
Simplified0.8
rmApplied pow-exp0.7
if -6.488171268588006e-15 < (* a x) Initial program 45.1
Taylor expanded around 0 13.8
Simplified13.8
Final simplification9.3
herbie shell --seed 2020106 +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))