e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -173.653260833614780267453170381486415863:\\
\;\;\;\;{\left(e^{a}\right)}^{x} - 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, x, \left(x \cdot \mathsf{fma}\left(\frac{1}{2}, a \cdot a, \frac{1}{6} \cdot \left(\left(a \cdot a\right) \cdot \left(a \cdot x\right)\right)\right)\right) \cdot x\right)\\
\end{array}double f(double a, double x) {
double r41214 = a;
double r41215 = x;
double r41216 = r41214 * r41215;
double r41217 = exp(r41216);
double r41218 = 1.0;
double r41219 = r41217 - r41218;
return r41219;
}
double f(double a, double x) {
double r41220 = a;
double r41221 = x;
double r41222 = r41220 * r41221;
double r41223 = -173.65326083361478;
bool r41224 = r41222 <= r41223;
double r41225 = exp(r41220);
double r41226 = pow(r41225, r41221);
double r41227 = 1.0;
double r41228 = r41226 - r41227;
double r41229 = 0.5;
double r41230 = r41220 * r41220;
double r41231 = 0.16666666666666666;
double r41232 = r41230 * r41222;
double r41233 = r41231 * r41232;
double r41234 = fma(r41229, r41230, r41233);
double r41235 = r41221 * r41234;
double r41236 = r41235 * r41221;
double r41237 = fma(r41220, r41221, r41236);
double r41238 = r41224 ? r41228 : r41237;
return r41238;
}




Bits error versus a




Bits error versus x
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 8.0 |
if (* a x) < -173.65326083361478Initial program 0
rmApplied add-log-exp14.3
Applied exp-to-pow14.3
if -173.65326083361478 < (* a x) Initial program 44.1
rmApplied add-cbrt-cube44.2
Simplified44.2
Taylor expanded around 0 14.4
Simplified11.7
rmApplied sqr-pow11.7
Applied associate-*l*7.8
Simplified7.8
rmApplied unpow37.8
Applied associate-*l*4.9
Final simplification8.0
herbie shell --seed 2019325 +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))