| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 3456 |
\[\frac{1}{e^{\frac{-x}{s}} + 1}
\]
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
(FPCore (x s) :precision binary32 (exp (- (log1p (exp (/ (- x) s))))))
float code(float x, float s) {
return 1.0f / (1.0f + expf((-x / s)));
}
float code(float x, float s) {
return expf(-log1pf(expf((-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 exp(Float32(-log1p(exp(Float32(Float32(-x) / s))))) end
\frac{1}{1 + e^{\frac{-x}{s}}}
e^{-\mathsf{log1p}\left(e^{\frac{-x}{s}}\right)}
Results
Initial program 0.1
Applied egg-rr0.1
Applied egg-rr0.0
Simplified0.0
[Start]0.0 | \[ e^{-\mathsf{log1p}\left(e^{-\frac{x}{s}}\right)}
\] |
|---|---|
*-rgt-identity [<=]0.0 | \[ e^{-\color{blue}{\mathsf{log1p}\left(e^{-\frac{x}{s}}\right) \cdot 1}}
\] |
*-rgt-identity [=>]0.0 | \[ e^{-\color{blue}{\mathsf{log1p}\left(e^{-\frac{x}{s}}\right)}}
\] |
distribute-neg-frac [=>]0.0 | \[ e^{-\mathsf{log1p}\left(e^{\color{blue}{\frac{-x}{s}}}\right)}
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 3456 |
| Alternative 2 | |
|---|---|
| Error | 10.7 |
| Cost | 388 |
| Alternative 3 | |
|---|---|
| Error | 16.4 |
| Cost | 356 |
| Alternative 4 | |
|---|---|
| Error | 17.1 |
| Cost | 228 |
| Alternative 5 | |
|---|---|
| Error | 16.9 |
| Cost | 164 |
| Alternative 6 | |
|---|---|
| Error | 20.7 |
| Cost | 32 |
herbie shell --seed 2023041
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))