?

Average Error: 0.0 → 0.0
Time: 1.8min
Precision: binary64
Cost: 13312

?

\[0 \leq s \land s \leq 1.0651631\]
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
\[\frac{1}{1 + {\left(e^{-1}\right)}^{\left(\frac{x}{s}\right)}} \]
(FPCore (x s) :precision binary64 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary64 (/ 1.0 (+ 1.0 (pow (exp -1.0) (/ x s)))))
double code(double x, double s) {
	return 1.0 / (1.0 + exp((-x / s)));
}
double code(double x, double s) {
	return 1.0 / (1.0 + pow(exp(-1.0), (x / s)));
}
real(8) function code(x, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: s
    code = 1.0d0 / (1.0d0 + exp((-x / s)))
end function
real(8) function code(x, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: s
    code = 1.0d0 / (1.0d0 + (exp((-1.0d0)) ** (x / s)))
end function
public static double code(double x, double s) {
	return 1.0 / (1.0 + Math.exp((-x / s)));
}
public static double code(double x, double s) {
	return 1.0 / (1.0 + Math.pow(Math.exp(-1.0), (x / s)));
}
def code(x, s):
	return 1.0 / (1.0 + math.exp((-x / s)))
def code(x, s):
	return 1.0 / (1.0 + math.pow(math.exp(-1.0), (x / s)))
function code(x, s)
	return Float64(1.0 / Float64(1.0 + exp(Float64(Float64(-x) / s))))
end
function code(x, s)
	return Float64(1.0 / Float64(1.0 + (exp(-1.0) ^ Float64(x / s))))
end
function tmp = code(x, s)
	tmp = 1.0 / (1.0 + exp((-x / s)));
end
function tmp = code(x, s)
	tmp = 1.0 / (1.0 + (exp(-1.0) ^ (x / s)));
end
code[x_, s_] := N[(1.0 / N[(1.0 + N[Exp[N[((-x) / s), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, s_] := N[(1.0 / N[(1.0 + N[Power[N[Exp[-1.0], $MachinePrecision], N[(x / s), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{1 + e^{\frac{-x}{s}}}
\frac{1}{1 + {\left(e^{-1}\right)}^{\left(\frac{x}{s}\right)}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

    \[\frac{1}{1 + e^{\frac{-x}{s}}} \]
  2. Applied egg-rr0.0

    \[\leadsto \frac{1}{1 + \color{blue}{{\left(e^{-1}\right)}^{\left(\frac{x}{s}\right)}}} \]

Alternatives

Alternative 1
Error1.0
Cost7044
\[\begin{array}{l} \mathbf{if}\;-x \leq -5 \cdot 10^{-298}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\frac{x}{s}}}{1 - -1}\\ \end{array} \]
Alternative 2
Error0.0
Cost6976
\[\frac{1}{1 + \frac{1}{e^{\frac{x}{s}}}} \]
Alternative 3
Error0.0
Cost6912
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
Alternative 4
Error3.8
Cost2252
\[\begin{array}{l} t_0 := \frac{s - x}{s}\\ \mathbf{if}\;-x \leq 5 \cdot 10^{-188}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\ \mathbf{elif}\;-x \leq 10^{-60}:\\ \;\;\;\;\frac{1}{\begin{array}{l} \mathbf{if}\;t_0 \ne 0:\\ \;\;\;\;t_0 \cdot \left(1 + \left(\left(1 + \frac{x \cdot x}{s \cdot s}\right) + \frac{x}{s}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 - \frac{x}{s}\\ \end{array}}\\ \mathbf{else}:\\ \;\;\;\;3 - \left(3 + \frac{1}{\frac{x}{s}}\right)\\ \end{array} \]
Alternative 5
Error3.8
Cost1480
\[\begin{array}{l} \mathbf{if}\;-x \leq 5 \cdot 10^{-188}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\ \mathbf{elif}\;-x \leq 10^{-60}:\\ \;\;\;\;\frac{1}{1 + \left(\left(\frac{x \cdot x}{s \cdot s} - \frac{x}{s}\right) - -1\right)}\\ \mathbf{else}:\\ \;\;\;\;3 - \left(3 + \frac{1}{\frac{x}{s}}\right)\\ \end{array} \]
Alternative 6
Error8.3
Cost968
\[\begin{array}{l} \mathbf{if}\;-x \leq -1 \cdot 10^{-171}:\\ \;\;\;\;\frac{1}{1 + \frac{s}{x}}\\ \mathbf{elif}\;-x \leq 10^{-172}:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;3 - \left(3 + \frac{1}{\frac{x}{s}}\right)\\ \end{array} \]
Alternative 7
Error4.8
Cost900
\[\begin{array}{l} \mathbf{if}\;-x \leq 10^{-172}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\ \mathbf{else}:\\ \;\;\;\;3 - \left(3 + \frac{1}{\frac{x}{s}}\right)\\ \end{array} \]
Alternative 8
Error19.1
Cost840
\[\begin{array}{l} \mathbf{if}\;-x \leq -1 \cdot 10^{-171}:\\ \;\;\;\;\frac{x - s}{x}\\ \mathbf{elif}\;-x \leq 4 \cdot 10^{-26}:\\ \;\;\;\;0.5 + \frac{0.25 \cdot x}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{x}{s}}\\ \end{array} \]
Alternative 9
Error18.9
Cost840
\[\begin{array}{l} \mathbf{if}\;-x \leq -1 \cdot 10^{-171}:\\ \;\;\;\;\frac{1}{1 + \frac{s}{x}}\\ \mathbf{elif}\;-x \leq 4 \cdot 10^{-26}:\\ \;\;\;\;0.5 + \frac{0.25 \cdot x}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{x}{s}}\\ \end{array} \]
Alternative 10
Error19.2
Cost712
\[\begin{array}{l} \mathbf{if}\;-x \leq -2 \cdot 10^{-112}:\\ \;\;\;\;\frac{x - s}{x}\\ \mathbf{elif}\;-x \leq 4 \cdot 10^{-26}:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{x}{s}}\\ \end{array} \]
Alternative 11
Error18.9
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq 9.2 \cdot 10^{-172}:\\ \;\;\;\;\frac{1}{2 - \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \frac{s}{x}}\\ \end{array} \]
Alternative 12
Error35.3
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{\frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 13
Error35.6
Cost388
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{-14}:\\ \;\;\;\;\frac{s}{-x}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 14
Error43.4
Cost64
\[0.5 \]

Error

Reproduce?

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