\frac{2}{1 + e^{-2 \cdot x}} - 1\begin{array}{l}
\mathbf{if}\;-2 \cdot x \le -0.04639353646233555783506830039186752401292:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt[3]{\mathsf{fma}\left(\frac{\sqrt{2}}{1}, \frac{\sqrt{2}}{1 + e^{-2 \cdot x}}, -1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{\sqrt{2}}{1}, \frac{\sqrt{2}}{1 + e^{-2 \cdot x}}, -1\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{\sqrt{2}}{1}, \frac{\sqrt{2}}{1 + e^{-2 \cdot x}}, -1\right)}\right)\right)\\
\mathbf{elif}\;-2 \cdot x \le 7.357856183748689123394269679412382258177 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(2 \cdot 0.5, x, 2 \cdot 0.5 - \mathsf{fma}\left(0.1666666666666666851703837437526090070605 \cdot 2, {x}^{3}, 1\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2}{1 + e^{-2 \cdot x}} - 1\right)\right)\\
\end{array}double f(double x, double __attribute__((unused)) y) {
double r76083 = 2.0;
double r76084 = 1.0;
double r76085 = -2.0;
double r76086 = x;
double r76087 = r76085 * r76086;
double r76088 = exp(r76087);
double r76089 = r76084 + r76088;
double r76090 = r76083 / r76089;
double r76091 = r76090 - r76084;
return r76091;
}
double f(double x, double __attribute__((unused)) y) {
double r76092 = -2.0;
double r76093 = x;
double r76094 = r76092 * r76093;
double r76095 = -0.04639353646233556;
bool r76096 = r76094 <= r76095;
double r76097 = 2.0;
double r76098 = sqrt(r76097);
double r76099 = 1.0;
double r76100 = r76098 / r76099;
double r76101 = 1.0;
double r76102 = exp(r76094);
double r76103 = r76101 + r76102;
double r76104 = r76098 / r76103;
double r76105 = -r76101;
double r76106 = fma(r76100, r76104, r76105);
double r76107 = cbrt(r76106);
double r76108 = r76107 * r76107;
double r76109 = r76108 * r76107;
double r76110 = log1p(r76109);
double r76111 = expm1(r76110);
double r76112 = 7.357856183748689e-11;
bool r76113 = r76094 <= r76112;
double r76114 = 0.5;
double r76115 = r76097 * r76114;
double r76116 = 0.16666666666666669;
double r76117 = r76116 * r76097;
double r76118 = 3.0;
double r76119 = pow(r76093, r76118);
double r76120 = fma(r76117, r76119, r76101);
double r76121 = r76115 - r76120;
double r76122 = fma(r76115, r76093, r76121);
double r76123 = log1p(r76122);
double r76124 = expm1(r76123);
double r76125 = r76097 / r76103;
double r76126 = r76125 - r76101;
double r76127 = log1p(r76126);
double r76128 = expm1(r76127);
double r76129 = r76113 ? r76124 : r76128;
double r76130 = r76096 ? r76111 : r76129;
return r76130;
}



Bits error versus x



Bits error versus y
if (* -2.0 x) < -0.04639353646233556Initial program 0.0
rmApplied expm1-log1p-u0.0
rmApplied *-un-lft-identity0.0
Applied add-sqr-sqrt1.6
Applied times-frac1.6
Applied fma-neg1.0
rmApplied add-cube-cbrt0.0
if -0.04639353646233556 < (* -2.0 x) < 7.357856183748689e-11Initial program 59.5
rmApplied expm1-log1p-u59.5
rmApplied *-un-lft-identity59.5
Applied add-sqr-sqrt60.6
Applied times-frac60.6
Applied fma-neg60.6
Taylor expanded around 0 60.6
Simplified0.1
if 7.357856183748689e-11 < (* -2.0 x) Initial program 0.4
rmApplied expm1-log1p-u0.4
Final simplification0.2
herbie shell --seed 2019353 +o rules:numerics
(FPCore (x y)
:name "Logistic function from Lakshay Garg"
:precision binary64
(- (/ 2 (+ 1 (exp (* -2 x)))) 1))