
(FPCore (x s) :precision binary32 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0))) (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
float t_0 = expf((-fabsf(x) / s));
float t_1 = 1.0f + t_0;
return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
t_0 = exp((-abs(x) / s))
t_1 = 1.0e0 + t_0
code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s) t_0 = exp(Float32(Float32(-abs(x)) / s)) t_1 = Float32(Float32(1.0) + t_0) return Float32(t_0 / Float32(Float32(s * t_1) * t_1)) end
function tmp = code(x, s) t_0 = exp((-abs(x) / s)); t_1 = single(1.0) + t_0; tmp = t_0 / ((s * t_1) * t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1}
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x s) :precision binary32 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0))) (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
float t_0 = expf((-fabsf(x) / s));
float t_1 = 1.0f + t_0;
return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
t_0 = exp((-abs(x) / s))
t_1 = 1.0e0 + t_0
code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s) t_0 = exp(Float32(Float32(-abs(x)) / s)) t_1 = Float32(Float32(1.0) + t_0) return Float32(t_0 / Float32(Float32(s * t_1) * t_1)) end
function tmp = code(x, s) t_0 = exp((-abs(x) / s)); t_1 = single(1.0) + t_0; tmp = t_0 / ((s * t_1) * t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1}
\end{array}
\end{array}
(FPCore (x s) :precision binary32 (/ 1.0 (* (+ 1.0 (exp (/ (- x) s))) (* s (exp (log1p (exp (/ x s))))))))
float code(float x, float s) {
return 1.0f / ((1.0f + expf((-x / s))) * (s * expf(log1pf(expf((x / s))))));
}
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))) * Float32(s * exp(log1p(exp(Float32(x / s))))))) end
\begin{array}{l}
\\
\frac{1}{\left(1 + e^{\frac{-x}{s}}\right) \cdot \left(s \cdot e^{\mathsf{log1p}\left(e^{\frac{x}{s}}\right)}\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
add-exp-log22.3%
add-exp-log22.3%
log1p-udef22.3%
prod-exp22.2%
Applied egg-rr60.9%
exp-sum61.1%
rem-exp-log62.3%
Simplified62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x s) :precision binary32 (/ 1.0 (* (+ 1.0 (exp (/ (- x) s))) (* s (+ 1.0 (exp (/ x s)))))))
float code(float x, float s) {
return 1.0f / ((1.0f + expf((-x / s))) * (s * (1.0f + expf((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))) * (s * (1.0e0 + exp((x / s)))))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))) * Float32(s * Float32(Float32(1.0) + exp(Float32(x / s)))))) end
function tmp = code(x, s) tmp = single(1.0) / ((single(1.0) + exp((-x / s))) * (s * (single(1.0) + exp((x / s))))); end
\begin{array}{l}
\\
\frac{1}{\left(1 + e^{\frac{-x}{s}}\right) \cdot \left(s \cdot \left(1 + e^{\frac{x}{s}}\right)\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr98.9%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified98.9%
Final simplification98.9%
(FPCore (x s) :precision binary32 (/ 1.0 (* (+ 1.0 (exp (/ (- x) s))) (+ s (* s (exp (/ x s)))))))
float code(float x, float s) {
return 1.0f / ((1.0f + expf((-x / s))) * (s + (s * expf((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))) * (s + (s * exp((x / s)))))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + exp(Float32(Float32(-x) / s))) * Float32(s + Float32(s * exp(Float32(x / s)))))) end
function tmp = code(x, s) tmp = single(1.0) / ((single(1.0) + exp((-x / s))) * (s + (s * exp((x / s))))); end
\begin{array}{l}
\\
\frac{1}{\left(1 + e^{\frac{-x}{s}}\right) \cdot \left(s + s \cdot e^{\frac{x}{s}}\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr98.9%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified98.9%
distribute-lft1-in72.6%
*-commutative72.6%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x s) :precision binary32 (/ 1.0 (* (+ s (* s (exp (/ x s)))) (- 2.0 (/ x s)))))
float code(float x, float s) {
return 1.0f / ((s + (s * expf((x / s)))) * (2.0f - (x / s)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((s + (s * exp((x / s)))) * (2.0e0 - (x / s)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(s + Float32(s * exp(Float32(x / s)))) * Float32(Float32(2.0) - Float32(x / s)))) end
function tmp = code(x, s) tmp = single(1.0) / ((s + (s * exp((x / s)))) * (single(2.0) - (x / s))); end
\begin{array}{l}
\\
\frac{1}{\left(s + s \cdot e^{\frac{x}{s}}\right) \cdot \left(2 - \frac{x}{s}\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr98.9%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified98.9%
Taylor expanded in x around 0 72.6%
mul-1-neg72.6%
unsub-neg72.6%
Simplified72.6%
distribute-lft1-in72.6%
*-commutative72.6%
Applied egg-rr72.6%
Final simplification72.6%
(FPCore (x s) :precision binary32 (/ 1.0 (* (+ 1.0 (exp (/ x s))) (- (* s 2.0) x))))
float code(float x, float s) {
return 1.0f / ((1.0f + expf((x / s))) * ((s * 2.0f) - x));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((1.0e0 + exp((x / s))) * ((s * 2.0e0) - x))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + exp(Float32(x / s))) * Float32(Float32(s * Float32(2.0)) - x))) end
function tmp = code(x, s) tmp = single(1.0) / ((single(1.0) + exp((x / s))) * ((s * single(2.0)) - x)); end
\begin{array}{l}
\\
\frac{1}{\left(1 + e^{\frac{x}{s}}\right) \cdot \left(s \cdot 2 - x\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr98.9%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified98.9%
Taylor expanded in x around 0 72.6%
mul-1-neg72.6%
unsub-neg72.6%
Simplified72.6%
Taylor expanded in x around inf 25.7%
associate-*r*25.7%
neg-mul-125.7%
associate-*r*25.7%
distribute-rgt-out62.5%
+-commutative62.5%
sub-neg62.5%
*-commutative62.5%
Simplified62.5%
Final simplification62.5%
(FPCore (x s) :precision binary32 (/ 1.0 (* 2.0 (* s (+ 1.0 (pow E (/ x s)))))))
float code(float x, float s) {
return 1.0f / (2.0f * (s * (1.0f + powf(((float) M_E), (x / s)))));
}
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(2.0) * Float32(s * Float32(Float32(1.0) + (Float32(exp(1)) ^ Float32(x / s)))))) end
function tmp = code(x, s) tmp = single(1.0) / (single(2.0) * (s * (single(1.0) + (single(2.71828182845904523536) ^ (x / s))))); end
\begin{array}{l}
\\
\frac{1}{2 \cdot \left(s \cdot \left(1 + {e}^{\left(\frac{x}{s}\right)}\right)\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
Taylor expanded in s around inf 59.1%
*-un-lft-identity59.1%
exp-prod59.1%
Applied egg-rr59.1%
exp-1-e59.1%
Simplified59.1%
Final simplification59.1%
(FPCore (x s) :precision binary32 (/ 0.5 (* s (+ 1.0 (exp (/ x s))))))
float code(float x, float s) {
return 0.5f / (s * (1.0f + expf((x / s))));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 0.5e0 / (s * (1.0e0 + exp((x / s))))
end function
function code(x, s) return Float32(Float32(0.5) / Float32(s * Float32(Float32(1.0) + exp(Float32(x / s))))) end
function tmp = code(x, s) tmp = single(0.5) / (s * (single(1.0) + exp((x / s)))); end
\begin{array}{l}
\\
\frac{0.5}{s \cdot \left(1 + e^{\frac{x}{s}}\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
Taylor expanded in s around inf 59.1%
Taylor expanded in x around inf 59.1%
Final simplification59.1%
(FPCore (x s) :precision binary32 (/ 1.0 (* (- 2.0 (/ x s)) (+ x (* s 2.0)))))
float code(float x, float s) {
return 1.0f / ((2.0f - (x / s)) * (x + (s * 2.0f)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((2.0e0 - (x / s)) * (x + (s * 2.0e0)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(Float32(2.0) - Float32(x / s)) * Float32(x + Float32(s * Float32(2.0))))) end
function tmp = code(x, s) tmp = single(1.0) / ((single(2.0) - (x / s)) * (x + (s * single(2.0)))); end
\begin{array}{l}
\\
\frac{1}{\left(2 - \frac{x}{s}\right) \cdot \left(x + s \cdot 2\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
distribute-frac-neg62.3%
rec-exp62.3%
pow162.3%
pow162.3%
frac-2neg62.3%
frac-2neg62.3%
add-sqr-sqrt62.3%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod-0.0%
add-sqr-sqrt95.0%
add-sqr-sqrt-0.0%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod62.3%
add-sqr-sqrt62.3%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt99.0%
Applied egg-rr98.9%
rec-exp99.0%
distribute-neg-frac99.0%
Simplified98.9%
Taylor expanded in x around 0 72.6%
mul-1-neg72.6%
unsub-neg72.6%
Simplified72.6%
Taylor expanded in x around 0 64.0%
*-commutative27.4%
Simplified64.0%
Final simplification64.0%
(FPCore (x s) :precision binary32 (/ 1.0 (* 2.0 (* s (+ (/ x s) 2.0)))))
float code(float x, float s) {
return 1.0f / (2.0f * (s * ((x / s) + 2.0f)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (2.0e0 * (s * ((x / s) + 2.0e0)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(2.0) * Float32(s * Float32(Float32(x / s) + Float32(2.0))))) end
function tmp = code(x, s) tmp = single(1.0) / (single(2.0) * (s * ((x / s) + single(2.0)))); end
\begin{array}{l}
\\
\frac{1}{2 \cdot \left(s \cdot \left(\frac{x}{s} + 2\right)\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
Taylor expanded in s around inf 59.1%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
Simplified50.0%
Final simplification50.0%
(FPCore (x s) :precision binary32 (/ 1.0 (* 2.0 (+ x (* s 2.0)))))
float code(float x, float s) {
return 1.0f / (2.0f * (x + (s * 2.0f)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (2.0e0 * (x + (s * 2.0e0)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(2.0) * Float32(x + Float32(s * Float32(2.0))))) end
function tmp = code(x, s) tmp = single(1.0) / (single(2.0) * (x + (s * single(2.0)))); end
\begin{array}{l}
\\
\frac{1}{2 \cdot \left(x + s \cdot 2\right)}
\end{array}
Initial program 98.8%
Simplified98.9%
fma-udef98.9%
+-commutative98.9%
*-un-lft-identity98.9%
*-commutative98.9%
add-sqr-sqrt98.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod-0.0%
add-sqr-sqrt23.1%
distribute-rgt-in23.2%
*-commutative23.2%
*-un-lft-identity23.2%
Applied egg-rr62.3%
Taylor expanded in s around inf 59.1%
Taylor expanded in x around 0 27.4%
*-commutative27.4%
Simplified27.4%
Final simplification27.4%
(FPCore (x s) :precision binary32 (if (<= x 9.999999974752427e-7) (/ 0.25 s) (/ 0.5 x)))
float code(float x, float s) {
float tmp;
if (x <= 9.999999974752427e-7f) {
tmp = 0.25f / s;
} else {
tmp = 0.5f / x;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 9.999999974752427e-7) then
tmp = 0.25e0 / s
else
tmp = 0.5e0 / x
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(9.999999974752427e-7)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(Float32(0.5) / x); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(9.999999974752427e-7)) tmp = single(0.25) / s; else tmp = single(0.5) / x; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.999999974752427 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\
\end{array}
\end{array}
if x < 9.99999997e-7Initial program 98.5%
*-commutative98.5%
distribute-lft-in98.6%
*-rgt-identity98.6%
fabs-neg98.6%
distribute-frac-neg98.6%
exp-neg98.6%
associate-*r/98.6%
*-rgt-identity98.6%
*-lft-identity98.6%
metadata-eval98.6%
times-frac98.6%
neg-mul-198.6%
neg-mul-198.6%
fabs-neg98.6%
Simplified98.6%
Taylor expanded in s around inf 35.2%
if 9.99999997e-7 < x Initial program 99.7%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
*-un-lft-identity99.8%
*-commutative99.8%
add-sqr-sqrt99.8%
sqrt-unprod99.8%
sqr-neg99.8%
sqrt-unprod-0.0%
add-sqr-sqrt4.6%
distribute-rgt-in4.6%
*-commutative4.6%
*-un-lft-identity4.6%
Applied egg-rr99.8%
Taylor expanded in s around inf 97.2%
Taylor expanded in x around 0 11.6%
*-commutative11.6%
Simplified11.6%
Taylor expanded in x around inf 10.8%
Final simplification27.7%
(FPCore (x s) :precision binary32 (/ 0.25 s))
float code(float x, float s) {
return 0.25f / s;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 0.25e0 / s
end function
function code(x, s) return Float32(Float32(0.25) / s) end
function tmp = code(x, s) tmp = single(0.25) / s; end
\begin{array}{l}
\\
\frac{0.25}{s}
\end{array}
Initial program 98.8%
*-commutative98.8%
distribute-lft-in98.9%
*-rgt-identity98.9%
fabs-neg98.9%
distribute-frac-neg98.9%
exp-neg98.9%
associate-*r/98.9%
*-rgt-identity98.9%
*-lft-identity98.9%
metadata-eval98.9%
times-frac98.9%
neg-mul-198.9%
neg-mul-198.9%
fabs-neg98.9%
Simplified98.9%
Taylor expanded in s around inf 25.9%
Final simplification25.9%
herbie shell --seed 2024027
(FPCore (x s)
:name "Logistic distribution"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ (exp (/ (- (fabs x)) s)) (* (* s (+ 1.0 (exp (/ (- (fabs x)) s)))) (+ 1.0 (exp (/ (- (fabs x)) s))))))