?

Average Error: 0.1 → 0.1
Time: 11.2s
Precision: binary32
Cost: 6752

?

\[0 \leq s \land s \leq 1.0651631\]
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
\[\frac{1}{1 + e^{-1} \cdot e^{1 - \frac{x}{s}}} \]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s)
 :precision binary32
 (/ 1.0 (+ 1.0 (* (exp -1.0) (exp (- 1.0 (/ x s)))))))
float code(float x, float s) {
	return 1.0f / (1.0f + expf((-x / s)));
}
float code(float x, float s) {
	return 1.0f / (1.0f + (expf(-1.0f) * expf((1.0f - (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
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (1.0e0 + (exp((-1.0e0)) * exp((1.0e0 - (x / s)))))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))))
end
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(exp(Float32(-1.0)) * exp(Float32(Float32(1.0) - Float32(x / s))))))
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(1.0) + exp((-x / s)));
end
function tmp = code(x, s)
	tmp = single(1.0) / (single(1.0) + (exp(single(-1.0)) * exp((single(1.0) - (x / s)))));
end
\frac{1}{1 + e^{\frac{-x}{s}}}
\frac{1}{1 + e^{-1} \cdot e^{1 - \frac{x}{s}}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

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

    \[\leadsto \frac{1}{1 + \color{blue}{e^{-1} \cdot e^{1 - \frac{x}{s}}}} \]
  3. Final simplification0.1

    \[\leadsto \frac{1}{1 + e^{-1} \cdot e^{1 - \frac{x}{s}}} \]

Alternatives

Alternative 1
Error9.7
Cost3524
\[\begin{array}{l} \mathbf{if}\;\frac{-x}{s} \leq -2.0000000233721948 \cdot 10^{-7}:\\ \;\;\;\;\frac{1}{s \cdot \frac{2}{s}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot e^{\frac{x}{s}}\\ \end{array} \]
Alternative 2
Error0.1
Cost3456
\[\frac{1}{1 + e^{\frac{-x}{s}}} \]
Alternative 3
Error10.4
Cost644
\[\begin{array}{l} \mathbf{if}\;\frac{-x}{s} \leq -2:\\ \;\;\;\;\frac{1}{s \cdot \frac{2}{s}}\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(1 - \frac{\frac{s}{x}}{1 + s \cdot \frac{-2}{x}}\right)\\ \end{array} \]
Alternative 4
Error10.8
Cost388
\[\begin{array}{l} \mathbf{if}\;\frac{-x}{s} \leq 0.5:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{s}{x}\right) - 1\\ \end{array} \]
Alternative 5
Error16.8
Cost356
\[\begin{array}{l} t_0 := \frac{-x}{s}\\ \mathbf{if}\;t_0 \leq 0.5:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0}\\ \end{array} \]
Alternative 6
Error17.3
Cost196
\[\begin{array}{l} \mathbf{if}\;x \leq -0.00018000000272877514:\\ \;\;\;\;-\frac{s}{x}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 7
Error21.0
Cost32
\[0.5 \]

Error

Reproduce?

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