e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -1.9961401647367767 \cdot 10^{-21}:\\
\;\;\;\;\sqrt[3]{{\left(\sqrt[3]{\log \left(e^{e^{a \cdot x} - 1}\right) \cdot \left(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 f(double a, double x) {
double r99562 = a;
double r99563 = x;
double r99564 = r99562 * r99563;
double r99565 = exp(r99564);
double r99566 = 1.0;
double r99567 = r99565 - r99566;
return r99567;
}
double f(double a, double x) {
double r99568 = a;
double r99569 = x;
double r99570 = r99568 * r99569;
double r99571 = -1.9961401647367767e-21;
bool r99572 = r99570 <= r99571;
double r99573 = exp(r99570);
double r99574 = 1.0;
double r99575 = r99573 - r99574;
double r99576 = exp(r99575);
double r99577 = log(r99576);
double r99578 = r99577 * r99575;
double r99579 = cbrt(r99578);
double r99580 = sqrt(r99573);
double r99581 = -r99574;
double r99582 = fma(r99580, r99580, r99581);
double r99583 = cbrt(r99582);
double r99584 = r99579 * r99583;
double r99585 = 3.0;
double r99586 = pow(r99584, r99585);
double r99587 = cbrt(r99586);
double r99588 = 0.5;
double r99589 = 2.0;
double r99590 = pow(r99568, r99589);
double r99591 = pow(r99569, r99589);
double r99592 = r99590 * r99591;
double r99593 = 0.16666666666666666;
double r99594 = pow(r99568, r99585);
double r99595 = pow(r99569, r99585);
double r99596 = r99594 * r99595;
double r99597 = fma(r99593, r99596, r99570);
double r99598 = fma(r99588, r99592, r99597);
double r99599 = r99572 ? r99587 : r99598;
return r99599;
}




Bits error versus a




Bits error versus x
| 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))