| Alternative 1 | |
|---|---|
| Error | 0.8 |
| Cost | 3556 |
\[\begin{array}{l}
t_0 := \frac{-x}{s}\\
\mathbf{if}\;t_0 \leq -3:\\
\;\;\;\;1 + e^{t_0}\\
\mathbf{elif}\;t_0 \leq 1:\\
\;\;\;\;0.5 + x \cdot \frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (pow E (/ (- 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 + powf(((float) M_E), (-x / s)));
}
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(1)) ^ Float32(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) + (single(2.71828182845904523536) ^ (-x / s))); end
\frac{1}{1 + e^{\frac{-x}{s}}}
\frac{1}{1 + {e}^{\left(\frac{-x}{s}\right)}}
Results
Initial program 0.1
Applied egg-rr0.1
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.8 |
| Cost | 3556 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 3456 |
| Alternative 3 | |
|---|---|
| Error | 10.0 |
| Cost | 196 |
| Alternative 4 | |
|---|---|
| Error | 20.6 |
| Cost | 32 |
herbie shell --seed 2023187
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))