| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 3456 |
\[\frac{1}{1 + e^{\frac{-x}{s}}}
\]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary32 (let* ((t_0 (* (/ x s) 0.5))) (/ 1.0 (+ 1.0 (/ (/ 1.0 (pow E t_0)) (exp t_0))))))
float code(float x, float s) {
return 1.0f / (1.0f + expf((-x / s)));
}
float code(float x, float s) {
float t_0 = (x / s) * 0.5f;
return 1.0f / (1.0f + ((1.0f / powf(((float) M_E), t_0)) / expf(t_0)));
}
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function code(x, s) t_0 = Float32(Float32(x / s) * Float32(0.5)) return Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / (Float32(exp(1)) ^ t_0)) / exp(t_0)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
function tmp = code(x, s) t_0 = (x / s) * single(0.5); tmp = single(1.0) / (single(1.0) + ((single(1.0) / (single(2.71828182845904523536) ^ t_0)) / exp(t_0))); end
\frac{1}{1 + e^{\frac{-x}{s}}}
\begin{array}{l}
t_0 := \frac{x}{s} \cdot 0.5\\
\frac{1}{1 + \frac{\frac{1}{{e}^{t_0}}}{e^{t_0}}}
\end{array}
Results
Initial program 0.1
Applied egg-rr0.1
Applied egg-rr0.1
Applied egg-rr0.1
Applied egg-rr0.1
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 3456 |
| Alternative 2 | |
|---|---|
| Error | 10.0 |
| Cost | 196 |
| Alternative 3 | |
|---|---|
| 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)))))