e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.02916961651562611:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{e^{a \cdot x}}, \sqrt{e^{a \cdot x}}, -1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, \mathsf{fma}\left(x, a, {\left(x \cdot a\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
\end{array}double f(double a, double x) {
double r80628 = a;
double r80629 = x;
double r80630 = r80628 * r80629;
double r80631 = exp(r80630);
double r80632 = 1.0;
double r80633 = r80631 - r80632;
return r80633;
}
double f(double a, double x) {
double r80634 = a;
double r80635 = x;
double r80636 = r80634 * r80635;
double r80637 = -3.029169616515626;
bool r80638 = r80636 <= r80637;
double r80639 = exp(r80636);
double r80640 = sqrt(r80639);
double r80641 = 1.0;
double r80642 = -r80641;
double r80643 = fma(r80640, r80640, r80642);
double r80644 = 0.16666666666666666;
double r80645 = r80635 * r80634;
double r80646 = 3.0;
double r80647 = pow(r80645, r80646);
double r80648 = 2.0;
double r80649 = pow(r80645, r80648);
double r80650 = 0.5;
double r80651 = r80649 * r80650;
double r80652 = fma(r80635, r80634, r80651);
double r80653 = fma(r80644, r80647, r80652);
double r80654 = r80638 ? r80643 : r80653;
return r80654;
}




Bits error versus a




Bits error versus x
| Original | 29.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -3.029169616515626Initial program 0
rmApplied add-sqr-sqrt0
Applied fma-neg0
if -3.029169616515626 < (* a x) Initial program 43.7
Taylor expanded around 0 14.6
Simplified14.6
rmApplied pow-prod-down8.5
Simplified8.5
rmApplied add-sqr-sqrt36.2
Applied unpow-prod-down36.2
Applied add-sqr-sqrt49.9
Applied unpow-prod-down49.9
Applied unswap-sqr47.7
Simplified47.7
Simplified0.6
Taylor expanded around inf 14.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020036 +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))