e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.001614619952117295458710044542272044054698:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(\frac{1}{2}, \left(a \cdot x\right) \cdot {a}^{\left(\frac{2}{2}\right)}, a\right)\\
\end{array}double f(double a, double x) {
double r129359 = a;
double r129360 = x;
double r129361 = r129359 * r129360;
double r129362 = exp(r129361);
double r129363 = 1.0;
double r129364 = r129362 - r129363;
return r129364;
}
double f(double a, double x) {
double r129365 = a;
double r129366 = x;
double r129367 = r129365 * r129366;
double r129368 = -0.0016146199521172955;
bool r129369 = r129367 <= r129368;
double r129370 = exp(r129367);
double r129371 = 1.0;
double r129372 = r129370 - r129371;
double r129373 = exp(r129372);
double r129374 = log(r129373);
double r129375 = 0.5;
double r129376 = 2.0;
double r129377 = r129376 / r129376;
double r129378 = pow(r129365, r129377);
double r129379 = r129367 * r129378;
double r129380 = fma(r129375, r129379, r129365);
double r129381 = r129366 * r129380;
double r129382 = r129369 ? r129374 : r129381;
return r129382;
}




Bits error versus a




Bits error versus x
| Original | 29.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.0016146199521172955Initial program 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.0016146199521172955 < (* a x) Initial program 43.6
Taylor expanded around 0 13.7
Simplified10.6
Taylor expanded around 0 7.8
Simplified4.5
rmApplied sqr-pow4.5
Applied associate-*r*0.7
Simplified0.7
Final simplification0.4
herbie shell --seed 2019350 +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))