\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 -1.1009973366871088 \cdot 10^{-16}:\\
\;\;\;\;\frac{2 \cdot \frac{x \cdot x - 1}{e^{x} \cdot \left(x - 1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - \varepsilon\right)} + e^{x \cdot \varepsilon - x}}{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 -1.1009973366871088e-16) (/ (* 2.0 (/ (- (* x x) 1.0) (* (exp x) (- x 1.0)))) 2.0) (/ (+ (exp (* x (- -1.0 eps))) (exp (- (* x eps) x))) 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 <= -1.1009973366871088e-16) {
tmp = (2.0 * (((x * x) - 1.0) / (exp(x) * (x - 1.0)))) / 2.0;
} else {
tmp = (exp(x * (-1.0 - eps)) + exp((x * eps) - x)) / 2.0;
}
return tmp;
}












Bits error versus x












Bits error versus eps
Results
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 7040 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 13632 |
| Alternative 3 | |
|---|---|
| Error | 29.3 |
| Cost | 14400 |
| Alternative 4 | |
|---|---|
| Error | 29.3 |
| Cost | 27264 |
| Alternative 5 | |
|---|---|
| Error | 29.9 |
| Cost | 34368 |
| Alternative 6 | |
|---|---|
| Error | 29.9 |
| Cost | 47936 |
| Alternative 7 | |
|---|---|
| Error | 29.7 |
| Cost | 62272 |
| Alternative 8 | |
|---|---|
| Error | 46.7 |
| Cost | 62464 |
| Alternative 9 | |
|---|---|
| Error | 46.7 |
| Cost | 62848 |

if x < -1.10099733668710882e-16Initial program 57.4
Taylor expanded around 0 2.2
Simplified2.1
rmApplied neg-sub0_binary64_4142.1
Applied exp-diff_binary64_4672.0
Applied flip-+_binary64_3932.3
Applied frac-times_binary64_4292.2
Simplified2.2
Simplified2.2
Simplified2.2
if -1.10099733668710882e-16 < x Initial program 28.8
Taylor expanded around inf 0.5
Simplified0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2021043
(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))