\frac{2}{1 + e^{-2 \cdot x}} - 1\begin{array}{l}
\mathbf{if}\;-2 \cdot x \le -0.0010666532697164817:\\
\;\;\;\;e^{\log \left(\mathsf{fma}\left(\frac{2}{{1}^{3} + {\left(e^{-2 \cdot x}\right)}^{3}}, \mathsf{fma}\left(1, 1, e^{-2 \cdot x} \cdot \left(e^{-2 \cdot x} - 1\right)\right), -1\right)\right)}\\
\mathbf{elif}\;-2 \cdot x \le 1.11971615771184669 \cdot 10^{-4}:\\
\;\;\;\;1 \cdot x - \mathsf{fma}\left(5.55112 \cdot 10^{-17}, {x}^{4}, 0.33333333333333337 \cdot {x}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}\right)\\
\end{array}double f(double x, double __attribute__((unused)) y) {
double r39668 = 2.0;
double r39669 = 1.0;
double r39670 = -2.0;
double r39671 = x;
double r39672 = r39670 * r39671;
double r39673 = exp(r39672);
double r39674 = r39669 + r39673;
double r39675 = r39668 / r39674;
double r39676 = r39675 - r39669;
return r39676;
}
double f(double x, double __attribute__((unused)) y) {
double r39677 = -2.0;
double r39678 = x;
double r39679 = r39677 * r39678;
double r39680 = -0.0010666532697164817;
bool r39681 = r39679 <= r39680;
double r39682 = 2.0;
double r39683 = 1.0;
double r39684 = 3.0;
double r39685 = pow(r39683, r39684);
double r39686 = exp(r39679);
double r39687 = pow(r39686, r39684);
double r39688 = r39685 + r39687;
double r39689 = r39682 / r39688;
double r39690 = r39686 - r39683;
double r39691 = r39686 * r39690;
double r39692 = fma(r39683, r39683, r39691);
double r39693 = -r39683;
double r39694 = fma(r39689, r39692, r39693);
double r39695 = log(r39694);
double r39696 = exp(r39695);
double r39697 = 0.00011197161577118467;
bool r39698 = r39679 <= r39697;
double r39699 = r39683 * r39678;
double r39700 = 5.551115123125783e-17;
double r39701 = 4.0;
double r39702 = pow(r39678, r39701);
double r39703 = 0.33333333333333337;
double r39704 = pow(r39678, r39684);
double r39705 = r39703 * r39704;
double r39706 = fma(r39700, r39702, r39705);
double r39707 = r39699 - r39706;
double r39708 = r39683 + r39686;
double r39709 = r39682 / r39708;
double r39710 = r39709 - r39683;
double r39711 = exp(r39710);
double r39712 = log(r39711);
double r39713 = r39698 ? r39707 : r39712;
double r39714 = r39681 ? r39696 : r39713;
return r39714;
}



Bits error versus x



Bits error versus y
if (* -2.0 x) < -0.0010666532697164817Initial program 0.1
rmApplied flip3-+0.1
Applied associate-/r/0.1
Applied fma-neg0.1
rmApplied add-exp-log0.1
Simplified0.1
if -0.0010666532697164817 < (* -2.0 x) < 0.00011197161577118467Initial program 59.2
Taylor expanded around 0 0.0
Simplified0.0
if 0.00011197161577118467 < (* -2.0 x) Initial program 0.1
rmApplied add-log-exp0.1
Applied add-log-exp0.1
Applied diff-log0.1
Simplified0.1
Final simplification0.0
herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y)
:name "Logistic function from Lakshay Garg"
:precision binary64
(- (/ 2 (+ 1 (exp (* -2 x)))) 1))