e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.00127281244229751384:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(x \cdot a\right)}^{2}}{2} + \mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, a \cdot x\right)\\
\end{array}double f(double a, double x) {
double r120851 = a;
double r120852 = x;
double r120853 = r120851 * r120852;
double r120854 = exp(r120853);
double r120855 = 1.0;
double r120856 = r120854 - r120855;
return r120856;
}
double f(double a, double x) {
double r120857 = a;
double r120858 = x;
double r120859 = r120857 * r120858;
double r120860 = -0.0012728124422975138;
bool r120861 = r120859 <= r120860;
double r120862 = exp(r120859);
double r120863 = 1.0;
double r120864 = r120862 - r120863;
double r120865 = exp(r120864);
double r120866 = log(r120865);
double r120867 = r120858 * r120857;
double r120868 = 2.0;
double r120869 = pow(r120867, r120868);
double r120870 = r120869 / r120868;
double r120871 = 0.16666666666666666;
double r120872 = 3.0;
double r120873 = pow(r120867, r120872);
double r120874 = fma(r120871, r120873, r120859);
double r120875 = r120870 + r120874;
double r120876 = r120861 ? r120866 : r120875;
return r120876;
}




Bits error versus a




Bits error versus x
| Original | 29.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.0012728124422975138Initial program 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.0012728124422975138 < (* a x) Initial program 44.0
Taylor expanded around 0 14.7
Simplified14.7
rmApplied pow-prod-down8.6
Simplified8.6
rmApplied fma-udef8.6
Simplified0.5
Final simplification0.4
herbie shell --seed 2020083 +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))