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



Bits error versus x



Bits error versus eps
Results
if x < 226.99331786434493Initial program 39.3
Taylor expanded around 0 1.2
Simplified1.2
rmApplied add-cube-cbrt_binary641.2
Applied unpow-prod-down_binary641.2
Applied associate-*r*_binary641.2
Simplified1.2
if 226.99331786434493 < x Initial program 0.1
rmApplied add-cube-cbrt_binary640.1
Applied exp-prod_binary640.1
Simplified0.1
Final simplification0.9
herbie shell --seed 2020220
(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))