\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 0.714262824286621911:\\
\;\;\;\;\left(\sqrt[3]{\mathsf{fma}\left(1.38778 \cdot 10^{-17}, \frac{{x}^{3}}{\varepsilon}, 1 - 0.5 \cdot {x}^{2}\right)} \cdot \left({1}^{\frac{1}{3}} - 0.166666666666666657 \cdot \left({x}^{2} \cdot {1}^{\frac{1}{3}}\right)\right)\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(1.38778 \cdot 10^{-17}, \frac{{x}^{3}}{\varepsilon}, 1 - 0.5 \cdot {x}^{2}\right)}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(1.38778 \cdot 10^{-17}, \frac{{x}^{3}}{\varepsilon}, 1 - 0.5 \cdot {x}^{2}\right)}}\right) \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(1.38778 \cdot 10^{-17}, \frac{{x}^{3}}{\varepsilon}, 1 - 0.5 \cdot {x}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{e^{-\left(1 + \varepsilon\right) \cdot x}}{2}, 1 - \frac{1}{\varepsilon}, \sqrt{\frac{1 + \frac{1}{\varepsilon}}{2 \cdot e^{\left(1 - \varepsilon\right) \cdot x}}} \cdot \sqrt{\frac{1 + \frac{1}{\varepsilon}}{2 \cdot e^{\left(1 - \varepsilon\right) \cdot x}}}\right)\\
\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 <= 0.7142628242866219)) {
VAR = ((cbrt(fma(1.3877787807814457e-17, (pow(x, 3.0) / eps), (1.0 - (0.5 * pow(x, 2.0))))) * (pow(1.0, 0.3333333333333333) - (0.16666666666666666 * (pow(x, 2.0) * pow(1.0, 0.3333333333333333))))) * ((cbrt(cbrt(fma(1.3877787807814457e-17, (pow(x, 3.0) / eps), (1.0 - (0.5 * pow(x, 2.0)))))) * cbrt(cbrt(fma(1.3877787807814457e-17, (pow(x, 3.0) / eps), (1.0 - (0.5 * pow(x, 2.0))))))) * cbrt(cbrt(fma(1.3877787807814457e-17, (pow(x, 3.0) / eps), (1.0 - (0.5 * pow(x, 2.0))))))));
} else {
VAR = fma((exp(-((1.0 + eps) * x)) / 2.0), (1.0 - (1.0 / eps)), (sqrt(((1.0 + (1.0 / eps)) / (2.0 * exp(((1.0 - eps) * x))))) * sqrt(((1.0 + (1.0 / eps)) / (2.0 * exp(((1.0 - eps) * x)))))));
}
return VAR;
}



Bits error versus x



Bits error versus eps
Results
if x < 0.7142628242866219Initial program 39.0
Simplified39.0
Taylor expanded around 0 7.5
Simplified7.5
rmApplied add-cube-cbrt7.5
Taylor expanded around 0 7.2
rmApplied add-cube-cbrt7.2
if 0.7142628242866219 < x Initial program 0.8
Simplified0.8
rmApplied add-sqr-sqrt0.8
Final simplification5.7
herbie shell --seed 2020106 +o rules:numerics
(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))