| Alternative 1 | |
|---|---|
| Error | 99.8% |
| Cost | 3520.00 |
\[\frac{1}{1 + \left(1 + \mathsf{expm1}\left(\frac{-x}{s}\right)\right)}
\]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (pow (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 + powf(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)) ** (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) + (exp(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)) ^ (x / s))); end
\frac{1}{1 + e^{\frac{-x}{s}}}
\frac{1}{1 + {\left(e^{-1}\right)}^{\left(\frac{x}{s}\right)}}
Results
Initial program 99.8
Applied egg-rr99.8
Applied egg-rr99.8
Applied egg-rr99.8
Final simplification99.8
| Alternative 1 | |
|---|---|
| Error | 99.8% |
| Cost | 3520.00 |
| Alternative 2 | |
|---|---|
| Error | 99.8% |
| Cost | 3456.00 |
| Alternative 3 | |
|---|---|
| Error | 69.5% |
| Cost | 196.00 |
| Alternative 4 | |
|---|---|
| Error | 35.1% |
| Cost | 32.00 |
herbie shell --seed 2023093
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))