\frac{2}{1 + e^{-2 \cdot x}} - 1
\begin{array}{l}
t_0 := \frac{2}{1 + e^{-2 \cdot x}}\\
\mathbf{if}\;-2 \cdot x \leq -14.282067032076004:\\
\;\;\;\;\sqrt[3]{{\left(t_0 - 1\right)}^{3}}\\
\mathbf{elif}\;-2 \cdot x \leq 8.041944314323065 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{t_0}\\
\mathsf{fma}\left(t_1, t_1, -1\right)
\end{array}\\
\end{array}
(FPCore (x y) :precision binary64 (- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ 2.0 (+ 1.0 (exp (* -2.0 x))))))
(if (<= (* -2.0 x) -14.282067032076004)
(cbrt (pow (- t_0 1.0) 3.0))
(if (<= (* -2.0 x) 8.041944314323065e-11)
x
(let* ((t_1 (sqrt t_0))) (fma t_1 t_1 -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 t_0 = 2.0 / (1.0 + exp(-2.0 * x));
double tmp;
if ((-2.0 * x) <= -14.282067032076004) {
tmp = cbrt(pow((t_0 - 1.0), 3.0));
} else if ((-2.0 * x) <= 8.041944314323065e-11) {
tmp = x;
} else {
double t_1 = sqrt(t_0);
tmp = fma(t_1, t_1, -1.0);
}
return tmp;
}



Bits error versus x



Bits error versus y
if (*.f64 -2 x) < -14.282067032076004Initial program 0.0
Applied add-cbrt-cube_binary640.0
Simplified0.0
if -14.282067032076004 < (*.f64 -2 x) < 8.0419443143230653e-11Initial program 59.4
Taylor expanded in x around 0 0.4
if 8.0419443143230653e-11 < (*.f64 -2 x) Initial program 0.5
Applied add-sqr-sqrt_binary640.5
Applied fma-neg_binary640.5
Simplified0.5
Final simplification0.3
herbie shell --seed 2021329
(FPCore (x y)
:name "Logistic function from Lakshay Garg"
:precision binary64
(- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))