e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -2.63503256833740627 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(\sqrt[3]{e^{2 \cdot \left(a \cdot x\right)} - 1 \cdot 1} \cdot \sqrt[3]{e^{2 \cdot \left(a \cdot x\right)} - 1 \cdot 1}\right) \cdot \sqrt[3]{e^{2 \cdot \left(a \cdot x\right)} - 1 \cdot 1}}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{a \cdot x} + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({x}^{2}, \mathsf{fma}\left(x, \frac{1}{6} \cdot {a}^{3}, \frac{1}{2} \cdot {a}^{2}\right), a \cdot x\right)\\
\end{array}double f(double a, double x) {
double r73554 = a;
double r73555 = x;
double r73556 = r73554 * r73555;
double r73557 = exp(r73556);
double r73558 = 1.0;
double r73559 = r73557 - r73558;
return r73559;
}
double f(double a, double x) {
double r73560 = a;
double r73561 = x;
double r73562 = r73560 * r73561;
double r73563 = -2.6350325683374063e-11;
bool r73564 = r73562 <= r73563;
double r73565 = 2.0;
double r73566 = r73565 * r73562;
double r73567 = exp(r73566);
double r73568 = 1.0;
double r73569 = r73568 * r73568;
double r73570 = r73567 - r73569;
double r73571 = cbrt(r73570);
double r73572 = r73571 * r73571;
double r73573 = r73572 * r73571;
double r73574 = exp(r73562);
double r73575 = r73574 + r73568;
double r73576 = log1p(r73575);
double r73577 = expm1(r73576);
double r73578 = r73573 / r73577;
double r73579 = pow(r73561, r73565);
double r73580 = 0.16666666666666666;
double r73581 = 3.0;
double r73582 = pow(r73560, r73581);
double r73583 = r73580 * r73582;
double r73584 = 0.5;
double r73585 = pow(r73560, r73565);
double r73586 = r73584 * r73585;
double r73587 = fma(r73561, r73583, r73586);
double r73588 = fma(r73579, r73587, r73562);
double r73589 = r73564 ? r73578 : r73588;
return r73589;
}




Bits error versus a




Bits error versus x
| Original | 29.8 |
|---|---|
| Target | 0.2 |
| Herbie | 7.5 |
if (* a x) < -2.6350325683374063e-11Initial program 0.5
rmApplied flip--0.5
Simplified0.4
rmApplied expm1-log1p-u0.4
rmApplied add-cube-cbrt0.4
if -2.6350325683374063e-11 < (* a x) Initial program 45.0
Taylor expanded around 0 14.5
Simplified11.2
Final simplification7.5
herbie shell --seed 2019199 +o rules:numerics
(FPCore (a x)
:name "expax (section 3.5)"
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))