\frac{2}{1 + e^{-2 \cdot x}} - 1\begin{array}{l}
\mathbf{if}\;x \leq -1.1596556562901081:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 1.168008803591736:\\
\;\;\;\;x - x \cdot \left(0.3333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}(FPCore (x y) :precision binary64 (- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))
(FPCore (x y)
:precision binary64
(if (<= x -1.1596556562901081)
-1.0
(if (<= x 1.168008803591736)
(- x (* x (* 0.3333333333333333 (* x x))))
1.0)))double code(double x, double y) {
return (2.0 / (1.0 + exp(-2.0 * x))) - 1.0;
}
double code(double x, double y) {
double tmp;
if (x <= -1.1596556562901081) {
tmp = -1.0;
} else if (x <= 1.168008803591736) {
tmp = x - (x * (0.3333333333333333 * (x * x)));
} else {
tmp = 1.0;
}
return tmp;
}






Bits error versus x






Bits error versus y
Results
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 706 |
| Alternative 2 | |
|---|---|
| Error | 30.3 |
| Cost | 385 |
| Alternative 3 | |
|---|---|
| Error | 46.6 |
| Cost | 64 |

if x < -1.15965565629010814Initial program 0.2
if -1.15965565629010814 < x < 1.16800880359173598Initial program 58.5
Taylor expanded around 0 0.3
rmApplied unpow3_binary64_18490.3
Applied associate-*r*_binary64_17230.3
Simplified0.3
if 1.16800880359173598 < x Initial program 0.2
Final simplification0.2
herbie shell --seed 2021044
(FPCore (x y)
:name "Logistic function from Lakshay Garg"
:precision binary64
(- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))