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




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 9.4 |
if (* a x) < -2.418896691815581e-07Initial program 0.2
rmApplied flip3--0.2
Simplified0.2
if -2.418896691815581e-07 < (* a x) Initial program 44.6
Taylor expanded around 0 14.1
Simplified14.1
Final simplification9.4
herbie shell --seed 2020071
(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))