e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.6128960162996795 \cdot 10^{-4}:\\
\;\;\;\;\sqrt[3]{\left(e^{a \cdot x} - 1\right) \cdot \left(e^{a \cdot x} - 1\right)} \cdot \sqrt[3]{e^{a \cdot x} - 1}\\
\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 f(double a, double x) {
double r101420 = a;
double r101421 = x;
double r101422 = r101420 * r101421;
double r101423 = exp(r101422);
double r101424 = 1.0;
double r101425 = r101423 - r101424;
return r101425;
}
double f(double a, double x) {
double r101426 = a;
double r101427 = x;
double r101428 = r101426 * r101427;
double r101429 = -0.00036128960162996795;
bool r101430 = r101428 <= r101429;
double r101431 = exp(r101428);
double r101432 = 1.0;
double r101433 = r101431 - r101432;
double r101434 = r101433 * r101433;
double r101435 = cbrt(r101434);
double r101436 = cbrt(r101433);
double r101437 = r101435 * r101436;
double r101438 = 0.5;
double r101439 = 2.0;
double r101440 = pow(r101426, r101439);
double r101441 = pow(r101427, r101439);
double r101442 = r101440 * r101441;
double r101443 = 0.16666666666666666;
double r101444 = 3.0;
double r101445 = pow(r101426, r101444);
double r101446 = pow(r101427, r101444);
double r101447 = r101445 * r101446;
double r101448 = fma(r101443, r101447, r101428);
double r101449 = fma(r101438, r101442, r101448);
double r101450 = r101430 ? r101437 : r101449;
return r101450;
}




Bits error versus a




Bits error versus x
| Original | 29.8 |
|---|---|
| Target | 0.2 |
| Herbie | 9.8 |
if (* a x) < -0.00036128960162996795Initial program 0.0
rmApplied add-sqr-sqrt0.0
Applied fma-neg0.0
rmApplied add-cbrt-cube0.0
Simplified0.0
rmApplied add-cube-cbrt0.0
Applied unpow-prod-down0.0
Applied cbrt-prod0.0
Simplified0.0
Simplified0.0
if -0.00036128960162996795 < (* a x) Initial program 44.5
Taylor expanded around 0 14.6
Simplified14.6
Final simplification9.8
herbie shell --seed 2020035 +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))