Average Error: 0.0 → 0.0
Time: 2.8s
Precision: binary64
Cost: 19520
\[0 \leq s \land s \leq 1.0651631\]
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
\[e^{-\mathsf{log1p}\left(e^{-\frac{x}{s}}\right)} \]
(FPCore (x s) :precision binary64 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary64 (exp (- (log1p (exp (- (/ x s)))))))
double code(double x, double s) {
	return 1.0 / (1.0 + exp((-x / s)));
}
double code(double x, double s) {
	return exp(-log1p(exp(-(x / s))));
}
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 Math.exp(-Math.log1p(Math.exp(-(x / s))));
}
def code(x, s):
	return 1.0 / (1.0 + math.exp((-x / s)))
def code(x, s):
	return math.exp(-math.log1p(math.exp(-(x / s))))
function code(x, s)
	return Float64(1.0 / Float64(1.0 + exp(Float64(Float64(-x) / s))))
end
function code(x, s)
	return exp(Float64(-log1p(exp(Float64(-Float64(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[Exp[(-N[Log[1 + N[Exp[(-N[(x / s), $MachinePrecision])], $MachinePrecision]], $MachinePrecision])], $MachinePrecision]
\frac{1}{1 + e^{\frac{-x}{s}}}
e^{-\mathsf{log1p}\left(e^{-\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. Simplified0.0

    \[\leadsto \color{blue}{e^{-\mathsf{log1p}\left(e^{-\frac{x}{s}}\right)}} \]
    Proof

Alternatives

Alternative 1
Error0.0
Cost6912
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
Alternative 2
Error43.2
Cost64
\[0.5 \]

Error

Reproduce

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