e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.00565259617492738353:\\
\;\;\;\;\frac{\log \left(e^{e^{2 \cdot \left(x \cdot a\right)} - 1 \cdot 1}\right)}{e^{a \cdot x} + 1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot a, \mathsf{fma}\left(0.5, x \cdot a, 1\right), {\left(a \cdot x\right)}^{3} \cdot 0.16666666666666663\right)\\
\end{array}double f(double a, double x) {
double r140875 = a;
double r140876 = x;
double r140877 = r140875 * r140876;
double r140878 = exp(r140877);
double r140879 = 1.0;
double r140880 = r140878 - r140879;
return r140880;
}
double f(double a, double x) {
double r140881 = a;
double r140882 = x;
double r140883 = r140881 * r140882;
double r140884 = -0.0056525961749273835;
bool r140885 = r140883 <= r140884;
double r140886 = 2.0;
double r140887 = r140882 * r140881;
double r140888 = r140886 * r140887;
double r140889 = exp(r140888);
double r140890 = 1.0;
double r140891 = r140890 * r140890;
double r140892 = r140889 - r140891;
double r140893 = exp(r140892);
double r140894 = log(r140893);
double r140895 = exp(r140883);
double r140896 = r140895 + r140890;
double r140897 = r140894 / r140896;
double r140898 = 0.5;
double r140899 = fma(r140898, r140887, r140890);
double r140900 = 3.0;
double r140901 = pow(r140883, r140900);
double r140902 = 0.16666666666666663;
double r140903 = r140901 * r140902;
double r140904 = fma(r140887, r140899, r140903);
double r140905 = r140885 ? r140897 : r140904;
return r140905;
}




Bits error versus a




Bits error versus x
| Original | 29.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.0056525961749273835Initial program 0.0
rmApplied flip--0.0
Simplified0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.0056525961749273835 < (* a x) Initial program 44.4
rmApplied flip--44.4
Simplified44.4
Taylor expanded around 0 14.4
Simplified0.6
Taylor expanded around inf 14.4
Simplified0.6
Final simplification0.4
herbie shell --seed 2020042 +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))