e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -1.3848736434257956 \cdot 10^{-5}:\\
\;\;\;\;\frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{e^{2 \cdot \left(a \cdot x\right)} + 1 \cdot \left(e^{a \cdot x} + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + \frac{1}{2} \cdot {\left(x \cdot a\right)}^{2}\\
\end{array}double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double VAR;
if ((((double) (a * x)) <= -1.3848736434257956e-05)) {
VAR = (((double) (((double) pow(((double) exp(((double) (a * x)))), 3.0)) - ((double) pow(1.0, 3.0)))) / ((double) (((double) exp(((double) (2.0 * ((double) (a * x)))))) + ((double) (1.0 * ((double) (((double) exp(((double) (a * x)))) + 1.0)))))));
} else {
VAR = ((double) (((double) (a * x)) + ((double) (0.5 * ((double) pow(((double) (x * a)), 2.0))))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -1.3848736434257956e-5Initial program 0.1
rmApplied flip3--0.1
Simplified0.1
if -1.3848736434257956e-5 < (* a x) Initial program 45.1
Taylor expanded around 0 15.4
Simplified8.1
Taylor expanded around 0 8.9
rmApplied pow-prod-down0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020182
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))