\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 154.4482937142435:\\
\;\;\;\;\frac{\sqrt[3]{\mathsf{fma}\left({x}^{3}, 8, 8 - 12 \cdot {x}^{2}\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(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}\right)}{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 <= 154.4482937142435)) {
VAR = (cbrt(fma(pow(x, 3.0), 8.0, (8.0 - (12.0 * pow(x, 2.0))))) / 2.0);
} else {
VAR = (fma((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 < 154.4482937142435Initial program 38.9
Taylor expanded around 0 1.2
Simplified1.2
rmApplied add-cbrt-cube1.2
Simplified1.2
Taylor expanded around 0 1.2
Simplified1.2
if 154.4482937142435 < x Initial program 0.2
rmApplied fma-neg0.2
Final simplification1.0
herbie shell --seed 2020100 +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))