\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 \leq 62.70095631767314:\\
\;\;\;\;\frac{\frac{{\left(0.6666666666666666 \cdot {x}^{3} + 2\right)}^{3} - {x}^{6}}{{x}^{4} + \left(0.6666666666666666 \cdot {x}^{3} + 2\right) \cdot \left(\left(0.6666666666666666 \cdot {x}^{3} + 2\right) + x \cdot x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} - \left(\sqrt[3]{\frac{1}{\varepsilon} - 1} \cdot \sqrt[3]{\frac{1}{\varepsilon} - 1}\right) \cdot \frac{\sqrt[3]{\frac{1}{\varepsilon} - 1}}{e^{x \cdot \left(1 + \varepsilon\right)}}}{2}\\
\end{array}(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
(FPCore (x eps)
:precision binary64
(if (<= x 62.70095631767314)
(/
(/
(- (pow (+ (* 0.6666666666666666 (pow x 3.0)) 2.0) 3.0) (pow x 6.0))
(+
(pow x 4.0)
(*
(+ (* 0.6666666666666666 (pow x 3.0)) 2.0)
(+ (+ (* 0.6666666666666666 (pow x 3.0)) 2.0) (* x x)))))
2.0)
(/
(-
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(*
(* (cbrt (- (/ 1.0 eps) 1.0)) (cbrt (- (/ 1.0 eps) 1.0)))
(/ (cbrt (- (/ 1.0 eps) 1.0)) (exp (* x (+ 1.0 eps))))))
2.0)))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 tmp;
if (x <= 62.70095631767314) {
tmp = ((pow(((0.6666666666666666 * pow(x, 3.0)) + 2.0), 3.0) - pow(x, 6.0)) / (pow(x, 4.0) + (((0.6666666666666666 * pow(x, 3.0)) + 2.0) * (((0.6666666666666666 * pow(x, 3.0)) + 2.0) + (x * x))))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps)) * exp(x * (eps + -1.0))) - ((cbrt((1.0 / eps) - 1.0) * cbrt((1.0 / eps) - 1.0)) * (cbrt((1.0 / eps) - 1.0) / exp(x * (1.0 + eps))))) / 2.0;
}
return tmp;
}



Bits error versus x



Bits error versus eps
Results
if x < 62.700956317673139Initial program 38.5
Taylor expanded around 0 1.4
Simplified1.4
rmApplied flip3--_binary64_7551.5
Simplified1.5
Simplified1.5
if 62.700956317673139 < x Initial program 0.3
rmApplied add-cube-cbrt_binary64_7830.3
Applied associate-*l*_binary64_6940.3
Simplified0.3
Final simplification1.2
herbie shell --seed 2020288
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))