\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 70.854524919311487:\\
\;\;\;\;\frac{\frac{\sqrt[3]{\left(-{\left(1 \cdot {x}^{2}\right)}^{3}\right) + {\left(0.66666666666666674 \cdot {x}^{3} + 2\right)}^{3}} \cdot \sqrt[3]{\left(-{\left(1 \cdot {x}^{2}\right)}^{3}\right) + {\left(0.66666666666666674 \cdot {x}^{3} + 2\right)}^{3}}}{\frac{\left(0.66666666666666674 \cdot {x}^{3} + 2\right) \cdot \left(0.66666666666666674 \cdot {x}^{3} + \left(2 + 1 \cdot {x}^{2}\right)\right) + 1 \cdot \left(1 \cdot {x}^{4}\right)}{\sqrt[3]{\left(-{\left(1 \cdot {x}^{2}\right)}^{3}\right) + {\left(0.66666666666666674 \cdot {x}^{3} + 2\right)}^{3}}}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{1}{\varepsilon}}{e^{\left(1 - \varepsilon\right) \cdot x}} - \left(\frac{1}{\varepsilon} - 1\right) \cdot 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 VAR;
if ((x <= 70.85452491931149)) {
VAR = (((cbrt((-pow((1.0 * pow(x, 2.0)), 3.0) + pow(((0.6666666666666667 * pow(x, 3.0)) + 2.0), 3.0))) * cbrt((-pow((1.0 * pow(x, 2.0)), 3.0) + pow(((0.6666666666666667 * pow(x, 3.0)) + 2.0), 3.0)))) / (((((0.6666666666666667 * pow(x, 3.0)) + 2.0) * ((0.6666666666666667 * pow(x, 3.0)) + (2.0 + (1.0 * pow(x, 2.0))))) + (1.0 * (1.0 * pow(x, 4.0)))) / cbrt((-pow((1.0 * pow(x, 2.0)), 3.0) + pow(((0.6666666666666667 * pow(x, 3.0)) + 2.0), 3.0))))) / 2.0);
} else {
VAR = ((((1.0 + (1.0 / eps)) / exp(((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0);
}
return VAR;
}



Bits error versus x



Bits error versus eps
Results
if x < 70.85452491931149Initial program 40.0
Taylor expanded around 0 1.3
rmApplied add-cbrt-cube1.3
Applied add-cbrt-cube1.3
Applied cbrt-unprod1.3
Simplified1.3
rmApplied flip3--1.3
Simplified1.3
Simplified1.3
rmApplied add-cube-cbrt1.3
Applied associate-/l*1.3
if 70.85452491931149 < x Initial program 0.2
rmApplied exp-neg0.2
Applied un-div-inv0.2
Final simplification1.0
herbie shell --seed 2020091
(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))