Logistic function

Percentage Accurate: 99.8% → 99.8%
Time: 7.7s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[0 \leq s \land s \leq 1.0651631\]
\[\begin{array}{l} \\ \frac{1}{1 + e^{\frac{-x}{s}}} \end{array} \]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
	return 1.0f / (1.0f + expf((-x / s)));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (1.0e0 + exp((-x / s)))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))))
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(1.0) + exp((-x / s)));
end
\begin{array}{l}

\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + e^{\frac{-x}{s}}} \end{array} \]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
	return 1.0f / (1.0f + expf((-x / s)));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (1.0e0 + exp((-x / s)))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))))
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(1.0) + exp((-x / s)));
end
\begin{array}{l}

\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + e^{\frac{x}{-s}}} \end{array} \]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ x (- s))))))
float code(float x, float s) {
	return 1.0f / (1.0f + expf((x / -s)));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (1.0e0 + exp((x / -s)))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(x / Float32(-s)))))
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(1.0) + exp((x / -s)));
end
\begin{array}{l}

\\
\frac{1}{1 + e^{\frac{x}{-s}}}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Add Preprocessing
  3. Final simplification99.9%

    \[\leadsto \frac{1}{1 + e^{\frac{x}{-s}}} \]
  4. Add Preprocessing

Alternative 2: 44.8% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9999999827968:\\ \;\;\;\;\frac{1}{2 - \frac{1}{\frac{s}{x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{4 - \frac{x}{s} \cdot \frac{x}{s}}{2 + \frac{x}{s}}}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x -9999999827968.0)
   (/ 1.0 (- 2.0 (/ 1.0 (/ s x))))
   (/ 1.0 (/ (- 4.0 (* (/ x s) (/ x s))) (+ 2.0 (/ x s))))))
float code(float x, float s) {
	float tmp;
	if (x <= -9999999827968.0f) {
		tmp = 1.0f / (2.0f - (1.0f / (s / x)));
	} else {
		tmp = 1.0f / ((4.0f - ((x / s) * (x / s))) / (2.0f + (x / s)));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= (-9999999827968.0e0)) then
        tmp = 1.0e0 / (2.0e0 - (1.0e0 / (s / x)))
    else
        tmp = 1.0e0 / ((4.0e0 - ((x / s) * (x / s))) / (2.0e0 + (x / s)))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(-9999999827968.0))
		tmp = Float32(Float32(1.0) / Float32(Float32(2.0) - Float32(Float32(1.0) / Float32(s / x))));
	else
		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) - Float32(Float32(x / s) * Float32(x / s))) / Float32(Float32(2.0) + Float32(x / s))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(-9999999827968.0))
		tmp = single(1.0) / (single(2.0) - (single(1.0) / (s / x)));
	else
		tmp = single(1.0) / ((single(4.0) - ((x / s) * (x / s))) / (single(2.0) + (x / s)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9999999827968:\\
\;\;\;\;\frac{1}{2 - \frac{1}{\frac{s}{x}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{4 - \frac{x}{s} \cdot \frac{x}{s}}{2 + \frac{x}{s}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9999999830000

    1. Initial program 100.0%

      \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 78.7%

      \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot \frac{x}{s}}} \]
    4. Step-by-step derivation
      1. neg-mul-178.7%

        \[\leadsto \frac{1}{2 + \color{blue}{\left(-\frac{x}{s}\right)}} \]
      2. unsub-neg78.7%

        \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
    5. Simplified78.7%

      \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
    6. Step-by-step derivation
      1. clear-num78.7%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{\frac{s}{x}}}} \]
      2. associate-/r/78.7%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
    7. Applied egg-rr78.7%

      \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
    8. Step-by-step derivation
      1. associate-*l/78.7%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1 \cdot x}{s}}} \]
      2. *-un-lft-identity78.7%

        \[\leadsto \frac{1}{2 - \frac{\color{blue}{x}}{s}} \]
      3. clear-num78.7%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{\frac{s}{x}}}} \]
    9. Applied egg-rr78.7%

      \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{\frac{s}{x}}}} \]

    if -9999999830000 < x

    1. Initial program 99.8%

      \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 36.4%

      \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot \frac{x}{s}}} \]
    4. Step-by-step derivation
      1. neg-mul-136.4%

        \[\leadsto \frac{1}{2 + \color{blue}{\left(-\frac{x}{s}\right)}} \]
      2. unsub-neg36.4%

        \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
    5. Simplified36.4%

      \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
    6. Step-by-step derivation
      1. clear-num36.4%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{\frac{s}{x}}}} \]
      2. associate-/r/36.4%

        \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
    7. Applied egg-rr36.4%

      \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
    8. Step-by-step derivation
      1. sub-neg36.4%

        \[\leadsto \frac{1}{\color{blue}{2 + \left(-\frac{1}{s} \cdot x\right)}} \]
      2. flip-+45.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot 2 - \left(-\frac{1}{s} \cdot x\right) \cdot \left(-\frac{1}{s} \cdot x\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}}} \]
      3. metadata-eval45.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{4} - \left(-\frac{1}{s} \cdot x\right) \cdot \left(-\frac{1}{s} \cdot x\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      4. associate-*l/45.0%

        \[\leadsto \frac{1}{\frac{4 - \left(-\color{blue}{\frac{1 \cdot x}{s}}\right) \cdot \left(-\frac{1}{s} \cdot x\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      5. *-un-lft-identity45.0%

        \[\leadsto \frac{1}{\frac{4 - \left(-\frac{\color{blue}{x}}{s}\right) \cdot \left(-\frac{1}{s} \cdot x\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      6. associate-*l/45.0%

        \[\leadsto \frac{1}{\frac{4 - \left(-\frac{x}{s}\right) \cdot \left(-\color{blue}{\frac{1 \cdot x}{s}}\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      7. *-un-lft-identity45.0%

        \[\leadsto \frac{1}{\frac{4 - \left(-\frac{x}{s}\right) \cdot \left(-\frac{\color{blue}{x}}{s}\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      8. distribute-neg-frac245.0%

        \[\leadsto \frac{1}{\frac{4 - \color{blue}{\frac{x}{-s}} \cdot \left(-\frac{x}{s}\right)}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      9. distribute-neg-frac245.0%

        \[\leadsto \frac{1}{\frac{4 - \frac{x}{-s} \cdot \color{blue}{\frac{x}{-s}}}{2 - \left(-\frac{1}{s} \cdot x\right)}} \]
      10. associate-*l/45.0%

        \[\leadsto \frac{1}{\frac{4 - \frac{x}{-s} \cdot \frac{x}{-s}}{2 - \left(-\color{blue}{\frac{1 \cdot x}{s}}\right)}} \]
      11. *-un-lft-identity45.0%

        \[\leadsto \frac{1}{\frac{4 - \frac{x}{-s} \cdot \frac{x}{-s}}{2 - \left(-\frac{\color{blue}{x}}{s}\right)}} \]
      12. distribute-neg-frac245.0%

        \[\leadsto \frac{1}{\frac{4 - \frac{x}{-s} \cdot \frac{x}{-s}}{2 - \color{blue}{\frac{x}{-s}}}} \]
    9. Applied egg-rr45.0%

      \[\leadsto \frac{1}{\color{blue}{\frac{4 - \frac{x}{-s} \cdot \frac{x}{-s}}{2 - \frac{x}{-s}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9999999827968:\\ \;\;\;\;\frac{1}{2 - \frac{1}{\frac{s}{x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{4 - \frac{x}{s} \cdot \frac{x}{s}}{2 + \frac{x}{s}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 40.5% accurate, 12.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\left(3 - \frac{x}{s}\right) + -1} \end{array} \]
(FPCore (x s) :precision binary32 (/ 1.0 (+ (- 3.0 (/ x s)) -1.0)))
float code(float x, float s) {
	return 1.0f / ((3.0f - (x / s)) + -1.0f);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / ((3.0e0 - (x / s)) + (-1.0e0))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(Float32(3.0) - Float32(x / s)) + Float32(-1.0)))
end
function tmp = code(x, s)
	tmp = single(1.0) / ((single(3.0) - (x / s)) + single(-1.0));
end
\begin{array}{l}

\\
\frac{1}{\left(3 - \frac{x}{s}\right) + -1}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 41.6%

    \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot \frac{x}{s}}} \]
  4. Step-by-step derivation
    1. neg-mul-141.6%

      \[\leadsto \frac{1}{2 + \color{blue}{\left(-\frac{x}{s}\right)}} \]
    2. unsub-neg41.6%

      \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
  5. Simplified41.6%

    \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
  6. Step-by-step derivation
    1. clear-num41.6%

      \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{\frac{s}{x}}}} \]
    2. associate-/r/41.6%

      \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
  7. Applied egg-rr41.6%

    \[\leadsto \frac{1}{2 - \color{blue}{\frac{1}{s} \cdot x}} \]
  8. Step-by-step derivation
    1. expm1-log1p-u39.6%

      \[\leadsto \frac{1}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 - \frac{1}{s} \cdot x\right)\right)}} \]
    2. associate-*l/39.6%

      \[\leadsto \frac{1}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 - \color{blue}{\frac{1 \cdot x}{s}}\right)\right)} \]
    3. *-un-lft-identity39.6%

      \[\leadsto \frac{1}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 - \frac{\color{blue}{x}}{s}\right)\right)} \]
  9. Applied egg-rr39.6%

    \[\leadsto \frac{1}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 - \frac{x}{s}\right)\right)}} \]
  10. Step-by-step derivation
    1. expm1-undefine39.6%

      \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{log1p}\left(2 - \frac{x}{s}\right)} - 1}} \]
    2. sub-neg39.6%

      \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{log1p}\left(2 - \frac{x}{s}\right)} + \left(-1\right)}} \]
    3. log1p-undefine39.6%

      \[\leadsto \frac{1}{e^{\color{blue}{\log \left(1 + \left(2 - \frac{x}{s}\right)\right)}} + \left(-1\right)} \]
    4. rem-exp-log41.5%

      \[\leadsto \frac{1}{\color{blue}{\left(1 + \left(2 - \frac{x}{s}\right)\right)} + \left(-1\right)} \]
    5. associate-+r-41.6%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(1 + 2\right) - \frac{x}{s}\right)} + \left(-1\right)} \]
    6. metadata-eval41.6%

      \[\leadsto \frac{1}{\left(\color{blue}{3} - \frac{x}{s}\right) + \left(-1\right)} \]
    7. metadata-eval41.6%

      \[\leadsto \frac{1}{\left(3 - \frac{x}{s}\right) + \color{blue}{-1}} \]
  11. Simplified41.6%

    \[\leadsto \frac{1}{\color{blue}{\left(3 - \frac{x}{s}\right) + -1}} \]
  12. Add Preprocessing

Alternative 4: 40.5% accurate, 15.4× speedup?

\[\begin{array}{l} \\ \frac{1}{2 - \frac{x}{s}} \end{array} \]
(FPCore (x s) :precision binary32 (/ 1.0 (- 2.0 (/ x s))))
float code(float x, float s) {
	return 1.0f / (2.0f - (x / s));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (2.0e0 - (x / s))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(2.0) - Float32(x / s)))
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(2.0) - (x / s));
end
\begin{array}{l}

\\
\frac{1}{2 - \frac{x}{s}}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 41.6%

    \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot \frac{x}{s}}} \]
  4. Step-by-step derivation
    1. neg-mul-141.6%

      \[\leadsto \frac{1}{2 + \color{blue}{\left(-\frac{x}{s}\right)}} \]
    2. unsub-neg41.6%

      \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
  5. Simplified41.6%

    \[\leadsto \frac{1}{\color{blue}{2 - \frac{x}{s}}} \]
  6. Add Preprocessing

Alternative 5: 29.2% accurate, 15.4× speedup?

\[\begin{array}{l} \\ 0.5 + \frac{0.25}{\frac{s}{x}} \end{array} \]
(FPCore (x s) :precision binary32 (+ 0.5 (/ 0.25 (/ s x))))
float code(float x, float s) {
	return 0.5f + (0.25f / (s / x));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 0.5e0 + (0.25e0 / (s / x))
end function
function code(x, s)
	return Float32(Float32(0.5) + Float32(Float32(0.25) / Float32(s / x)))
end
function tmp = code(x, s)
	tmp = single(0.5) + (single(0.25) / (s / x));
end
\begin{array}{l}

\\
0.5 + \frac{0.25}{\frac{s}{x}}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 32.0%

    \[\leadsto \color{blue}{0.5 + 0.25 \cdot \frac{x}{s}} \]
  4. Step-by-step derivation
    1. associate-*r/32.0%

      \[\leadsto 0.5 + \color{blue}{\frac{0.25 \cdot x}{s}} \]
  5. Simplified32.0%

    \[\leadsto \color{blue}{0.5 + \frac{0.25 \cdot x}{s}} \]
  6. Step-by-step derivation
    1. *-commutative32.0%

      \[\leadsto 0.5 + \frac{\color{blue}{x \cdot 0.25}}{s} \]
    2. associate-/l*32.0%

      \[\leadsto 0.5 + \color{blue}{x \cdot \frac{0.25}{s}} \]
  7. Applied egg-rr32.0%

    \[\leadsto 0.5 + \color{blue}{x \cdot \frac{0.25}{s}} \]
  8. Step-by-step derivation
    1. *-commutative32.0%

      \[\leadsto 0.5 + \color{blue}{\frac{0.25}{s} \cdot x} \]
    2. div-inv32.0%

      \[\leadsto 0.5 + \color{blue}{\left(0.25 \cdot \frac{1}{s}\right)} \cdot x \]
    3. associate-*l*32.0%

      \[\leadsto 0.5 + \color{blue}{0.25 \cdot \left(\frac{1}{s} \cdot x\right)} \]
    4. associate-*l/32.0%

      \[\leadsto 0.5 + 0.25 \cdot \color{blue}{\frac{1 \cdot x}{s}} \]
    5. *-un-lft-identity32.0%

      \[\leadsto 0.5 + 0.25 \cdot \frac{\color{blue}{x}}{s} \]
    6. clear-num32.0%

      \[\leadsto 0.5 + 0.25 \cdot \color{blue}{\frac{1}{\frac{s}{x}}} \]
    7. div-inv32.0%

      \[\leadsto 0.5 + \color{blue}{\frac{0.25}{\frac{s}{x}}} \]
  9. Applied egg-rr32.0%

    \[\leadsto 0.5 + \color{blue}{\frac{0.25}{\frac{s}{x}}} \]
  10. Add Preprocessing

Alternative 6: 29.2% accurate, 15.4× speedup?

\[\begin{array}{l} \\ 0.5 + x \cdot \frac{0.25}{s} \end{array} \]
(FPCore (x s) :precision binary32 (+ 0.5 (* x (/ 0.25 s))))
float code(float x, float s) {
	return 0.5f + (x * (0.25f / s));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 0.5e0 + (x * (0.25e0 / s))
end function
function code(x, s)
	return Float32(Float32(0.5) + Float32(x * Float32(Float32(0.25) / s)))
end
function tmp = code(x, s)
	tmp = single(0.5) + (x * (single(0.25) / s));
end
\begin{array}{l}

\\
0.5 + x \cdot \frac{0.25}{s}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 32.0%

    \[\leadsto \color{blue}{0.5 + 0.25 \cdot \frac{x}{s}} \]
  4. Step-by-step derivation
    1. associate-*r/32.0%

      \[\leadsto 0.5 + \color{blue}{\frac{0.25 \cdot x}{s}} \]
  5. Simplified32.0%

    \[\leadsto \color{blue}{0.5 + \frac{0.25 \cdot x}{s}} \]
  6. Step-by-step derivation
    1. *-commutative32.0%

      \[\leadsto 0.5 + \frac{\color{blue}{x \cdot 0.25}}{s} \]
    2. associate-/l*32.0%

      \[\leadsto 0.5 + \color{blue}{x \cdot \frac{0.25}{s}} \]
  7. Applied egg-rr32.0%

    \[\leadsto 0.5 + \color{blue}{x \cdot \frac{0.25}{s}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024179 
(FPCore (x s)
  :name "Logistic function"
  :precision binary32
  :pre (and (<= 0.0 s) (<= s 1.0651631))
  (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))