\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\begin{array}{l}
\mathbf{if}\;x \le 1.9121598632801717:\\
\;\;\;\;\left(0.33333333333333337 \cdot {x}^{3} + 1\right) - 0.5 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{1 + \frac{1}{\varepsilon}}{e^{\left(1 - \varepsilon\right) \cdot x}}}{2} - \frac{\frac{\frac{1}{\varepsilon}}{e^{\left(1 + \varepsilon\right) \cdot x}}}{2}\right) + \frac{\frac{1}{e^{\left(1 + \varepsilon\right) \cdot x}}}{2}\\
\end{array}double code(double x, double eps) {
return ((((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0);
}
double code(double x, double eps) {
double temp;
if ((x <= 1.9121598632801717)) {
temp = (((0.33333333333333337 * pow(x, 3.0)) + 1.0) - (0.5 * pow(x, 2.0)));
} else {
temp = (((((1.0 + (1.0 / eps)) / exp(((1.0 - eps) * x))) / 2.0) - (((1.0 / eps) / exp(((1.0 + eps) * x))) / 2.0)) + ((1.0 / exp(((1.0 + eps) * x))) / 2.0));
}
return temp;
}



Bits error versus x



Bits error versus eps
Results
if x < 1.9121598632801717Initial program 39.5
Simplified39.5
Taylor expanded around 0 1.3
if 1.9121598632801717 < x Initial program 0.5
Simplified0.5
rmApplied div-sub0.5
Applied div-sub0.5
Applied associate--r-0.5
Final simplification1.1
herbie shell --seed 2020066
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2))