e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.0361596251241738179:\\
\;\;\;\;\frac{e^{2 \cdot \left(x \cdot a\right)} - 1 \cdot 1}{e^{a \cdot x} + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x + \frac{1}{2} \cdot \left(x \cdot \left(a \cdot x\right)\right)\right)\\
\end{array}double f(double a, double x) {
double r116433 = a;
double r116434 = x;
double r116435 = r116433 * r116434;
double r116436 = exp(r116435);
double r116437 = 1.0;
double r116438 = r116436 - r116437;
return r116438;
}
double f(double a, double x) {
double r116439 = a;
double r116440 = x;
double r116441 = r116439 * r116440;
double r116442 = -0.03615962512417382;
bool r116443 = r116441 <= r116442;
double r116444 = 2.0;
double r116445 = r116440 * r116439;
double r116446 = r116444 * r116445;
double r116447 = exp(r116446);
double r116448 = 1.0;
double r116449 = r116448 * r116448;
double r116450 = r116447 - r116449;
double r116451 = exp(r116441);
double r116452 = r116451 + r116448;
double r116453 = r116450 / r116452;
double r116454 = 0.5;
double r116455 = r116440 * r116441;
double r116456 = r116454 * r116455;
double r116457 = r116440 + r116456;
double r116458 = r116439 * r116457;
double r116459 = r116443 ? r116453 : r116458;
return r116459;
}




Bits error versus a




Bits error versus x
Results
| Original | 28.9 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (* a x) < -0.03615962512417382Initial program 0.0
rmApplied flip--0.0
Simplified0.0
if -0.03615962512417382 < (* a x) Initial program 43.6
Taylor expanded around 0 14.5
Simplified7.9
Taylor expanded around 0 8.3
rmApplied unpow28.3
Applied associate-*l*4.7
Simplified0.7
Taylor expanded around inf 8.3
Simplified0.7
Final simplification0.5
herbie shell --seed 2020047
(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))