
(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 11 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 (* (exp (- (log1p (cosh (/ (fabs x) s))))) (/ 0.5 s)))
float code(float x, float s) {
return expf(-log1pf(coshf((fabsf(x) / s)))) * (0.5f / s);
}
function code(x, s) return Float32(exp(Float32(-log1p(cosh(Float32(abs(x) / s))))) * Float32(Float32(0.5) / s)) end
\begin{array}{l}
\\
e^{-\mathsf{log1p}\left(\cosh \left(\frac{\left|x\right|}{s}\right)\right)} \cdot \frac{0.5}{s}
\end{array}
Initial program 99.3%
Simplified99.4%
associate-+r+N/A
distribute-rgt-inN/A
+-lowering-+.f32N/A
Applied egg-rr99.4%
+-commutativeN/A
distribute-rgt-inN/A
associate-/r*N/A
div-invN/A
*-commutativeN/A
distribute-rgt1-inN/A
times-fracN/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
+-lowering-+.f32N/A
cosh-lowering-cosh.f32N/A
/-lowering-/.f32N/A
fabs-lowering-fabs.f32N/A
/-lowering-/.f32N/A
/-lowering-/.f3299.4%
Applied egg-rr99.4%
inv-powN/A
pow-to-expN/A
exp-lowering-exp.f32N/A
*-lowering-*.f32N/A
+-commutativeN/A
log1p-defineN/A
log1p-lowering-log1p.f32N/A
cosh-lowering-cosh.f32N/A
/-lowering-/.f32N/A
fabs-lowering-fabs.f3299.4%
Applied egg-rr99.4%
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f32N/A
metadata-eval99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x s) :precision binary32 (/ 1.0 (+ (* s (* (cosh (/ (fabs x) s)) 2.0)) (* s 2.0))))
float code(float x, float s) {
return 1.0f / ((s * (coshf((fabsf(x) / s)) * 2.0f)) + (s * 2.0f));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((s * (cosh((abs(x) / s)) * 2.0e0)) + (s * 2.0e0))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(s * Float32(cosh(Float32(abs(x) / s)) * Float32(2.0))) + Float32(s * Float32(2.0)))) end
function tmp = code(x, s) tmp = single(1.0) / ((s * (cosh((abs(x) / s)) * single(2.0))) + (s * single(2.0))); end
\begin{array}{l}
\\
\frac{1}{s \cdot \left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot 2\right) + s \cdot 2}
\end{array}
Initial program 99.3%
Simplified99.4%
associate-+r+N/A
distribute-rgt-inN/A
+-lowering-+.f32N/A
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x s) :precision binary32 (/ (/ 0.5 s) (+ (cosh (/ (fabs x) s)) 1.0)))
float code(float x, float s) {
return (0.5f / s) / (coshf((fabsf(x) / s)) + 1.0f);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = (0.5e0 / s) / (cosh((abs(x) / s)) + 1.0e0)
end function
function code(x, s) return Float32(Float32(Float32(0.5) / s) / Float32(cosh(Float32(abs(x) / s)) + Float32(1.0))) end
function tmp = code(x, s) tmp = (single(0.5) / s) / (cosh((abs(x) / s)) + single(1.0)); end
\begin{array}{l}
\\
\frac{\frac{0.5}{s}}{\cosh \left(\frac{\left|x\right|}{s}\right) + 1}
\end{array}
Initial program 99.3%
Simplified99.4%
associate-/r*N/A
/-lowering-/.f32N/A
/-lowering-/.f32N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f32N/A
div-invN/A
neg-sub0N/A
div-invN/A
+-commutativeN/A
distribute-frac-negN/A
cosh-undefN/A
*-lowering-*.f32N/A
frac-2negN/A
distribute-frac-neg2N/A
neg-sub0N/A
Applied egg-rr99.4%
*-commutativeN/A
distribute-rgt1-inN/A
div-invN/A
frac-timesN/A
*-commutativeN/A
un-div-invN/A
/-lowering-/.f32N/A
associate-/l/N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f32N/A
+-commutativeN/A
+-lowering-+.f32N/A
cosh-lowering-cosh.f32N/A
/-lowering-/.f32N/A
fabs-lowering-fabs.f3299.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x s) :precision binary32 (/ (/ 0.25 (exp (/ (fabs x) s))) s))
float code(float x, float s) {
return (0.25f / expf((fabsf(x) / s))) / s;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = (0.25e0 / exp((abs(x) / s))) / s
end function
function code(x, s) return Float32(Float32(Float32(0.25) / exp(Float32(abs(x) / s))) / s) end
function tmp = code(x, s) tmp = (single(0.25) / exp((abs(x) / s))) / s; end
\begin{array}{l}
\\
\frac{\frac{0.25}{e^{\frac{\left|x\right|}{s}}}}{s}
\end{array}
Initial program 99.3%
Taylor expanded in s around inf
*-commutativeN/A
*-lowering-*.f3295.5%
Simplified95.5%
Taylor expanded in x around 0
associate-*r/N/A
/-lowering-/.f32N/A
mul-1-negN/A
rec-expN/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32N/A
fabs-lowering-fabs.f3295.5%
Simplified95.5%
(FPCore (x s) :precision binary32 (if (<= x 4.999999987376214e-7) (/ 1.0 (* s (+ (* x (/ x (* s s))) 4.0))) (/ (* s (* s (* s -4.0))) (* (* x x) (* x x)))))
float code(float x, float s) {
float tmp;
if (x <= 4.999999987376214e-7f) {
tmp = 1.0f / (s * ((x * (x / (s * s))) + 4.0f));
} else {
tmp = (s * (s * (s * -4.0f))) / ((x * x) * (x * x));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 4.999999987376214e-7) then
tmp = 1.0e0 / (s * ((x * (x / (s * s))) + 4.0e0))
else
tmp = (s * (s * (s * (-4.0e0)))) / ((x * x) * (x * x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(4.999999987376214e-7)) tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(x * Float32(x / Float32(s * s))) + Float32(4.0)))); else tmp = Float32(Float32(s * Float32(s * Float32(s * Float32(-4.0)))) / Float32(Float32(x * x) * Float32(x * x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(4.999999987376214e-7)) tmp = single(1.0) / (s * ((x * (x / (s * s))) + single(4.0))); else tmp = (s * (s * (s * single(-4.0)))) / ((x * x) * (x * x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.999999987376214 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{s \cdot \left(x \cdot \frac{x}{s \cdot s} + 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{s \cdot \left(s \cdot \left(s \cdot -4\right)\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\\
\end{array}
\end{array}
if x < 4.99999999e-7Initial program 99.1%
Simplified99.2%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified75.1%
associate-/l/N/A
associate-/l*N/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
*-lowering-*.f3285.0%
Applied egg-rr85.0%
if 4.99999999e-7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified88.2%
Taylor expanded in x around inf
/-lowering-/.f32N/A
metadata-evalN/A
distribute-lft-neg-inN/A
+-lowering-+.f32N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r/N/A
/-lowering-/.f32N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3278.3%
Simplified78.3%
Taylor expanded in s around inf
associate-*r/N/A
/-lowering-/.f32N/A
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f32N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f32N/A
*-lowering-*.f32N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3295.0%
Simplified95.0%
(FPCore (x s) :precision binary32 (if (<= s 5.999999920033662e-24) (/ 1.0 (* s (/ (* x x) (* s s)))) (/ 1.0 (+ (/ (* x x) s) (* s 4.0)))))
float code(float x, float s) {
float tmp;
if (s <= 5.999999920033662e-24f) {
tmp = 1.0f / (s * ((x * x) / (s * s)));
} else {
tmp = 1.0f / (((x * x) / s) + (s * 4.0f));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (s <= 5.999999920033662e-24) then
tmp = 1.0e0 / (s * ((x * x) / (s * s)))
else
tmp = 1.0e0 / (((x * x) / s) + (s * 4.0e0))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (s <= Float32(5.999999920033662e-24)) tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(x * x) / Float32(s * s)))); else tmp = Float32(Float32(1.0) / Float32(Float32(Float32(x * x) / s) + Float32(s * Float32(4.0)))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (s <= single(5.999999920033662e-24)) tmp = single(1.0) / (s * ((x * x) / (s * s))); else tmp = single(1.0) / (((x * x) / s) + (s * single(4.0))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 5.999999920033662 \cdot 10^{-24}:\\
\;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x}{s} + s \cdot 4}\\
\end{array}
\end{array}
if s < 5.99999992e-24Initial program 99.7%
Simplified99.8%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified69.5%
Taylor expanded in x around inf
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3282.7%
Simplified82.7%
if 5.99999992e-24 < s Initial program 99.1%
Simplified99.2%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified84.3%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f32N/A
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f32N/A
*-commutativeN/A
*-lowering-*.f3280.5%
Simplified80.5%
(FPCore (x s) :precision binary32 (if (<= x 2.000000033724767e-16) (/ 0.25 s) (/ 1.0 (* s (/ (* x x) (* s s))))))
float code(float x, float s) {
float tmp;
if (x <= 2.000000033724767e-16f) {
tmp = 0.25f / s;
} else {
tmp = 1.0f / (s * ((x * x) / (s * s)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 2.000000033724767e-16) then
tmp = 0.25e0 / s
else
tmp = 1.0e0 / (s * ((x * x) / (s * s)))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(2.000000033724767e-16)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(x * x) / Float32(s * s)))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(2.000000033724767e-16)) tmp = single(0.25) / s; else tmp = single(1.0) / (s * ((x * x) / (s * s))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.000000033724767 \cdot 10^{-16}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\
\end{array}
\end{array}
if x < 2.00000003e-16Initial program 99.1%
Simplified99.2%
Taylor expanded in s around inf
/-lowering-/.f3239.1%
Simplified39.1%
if 2.00000003e-16 < x Initial program 99.9%
Simplified99.9%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified83.5%
Taylor expanded in x around inf
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3285.8%
Simplified85.8%
(FPCore (x s) :precision binary32 (/ 1.0 (* s (+ (* x (/ x (* s s))) 4.0))))
float code(float x, float s) {
return 1.0f / (s * ((x * (x / (s * s))) + 4.0f));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (s * ((x * (x / (s * s))) + 4.0e0))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(s * Float32(Float32(x * Float32(x / Float32(s * s))) + Float32(4.0)))) end
function tmp = code(x, s) tmp = single(1.0) / (s * ((x * (x / (s * s))) + single(4.0))); end
\begin{array}{l}
\\
\frac{1}{s \cdot \left(x \cdot \frac{x}{s \cdot s} + 4\right)}
\end{array}
Initial program 99.3%
Simplified99.4%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified78.6%
associate-/l/N/A
associate-/l*N/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
*-lowering-*.f3285.8%
Applied egg-rr85.8%
(FPCore (x s) :precision binary32 (if (<= x 4.999999987376214e-7) (/ 0.25 s) (/ 1.0 (/ x (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= 4.999999987376214e-7f) {
tmp = 0.25f / s;
} else {
tmp = 1.0f / (x / (s / x));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 4.999999987376214e-7) then
tmp = 0.25e0 / s
else
tmp = 1.0e0 / (x / (s / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(4.999999987376214e-7)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(Float32(1.0) / Float32(x / Float32(s / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(4.999999987376214e-7)) tmp = single(0.25) / s; else tmp = single(1.0) / (x / (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.999999987376214 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{s}{x}}}\\
\end{array}
\end{array}
if x < 4.99999999e-7Initial program 99.1%
Simplified99.2%
Taylor expanded in s around inf
/-lowering-/.f3238.3%
Simplified38.3%
if 4.99999999e-7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified88.2%
Taylor expanded in s around 0
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f3278.3%
Simplified78.3%
clear-numN/A
associate-*l/N/A
/-lowering-/.f32N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f32N/A
/-lowering-/.f3279.5%
Applied egg-rr79.5%
(FPCore (x s) :precision binary32 (if (<= x 4.999999987376214e-7) (/ 0.25 s) (/ s (* x x))))
float code(float x, float s) {
float tmp;
if (x <= 4.999999987376214e-7f) {
tmp = 0.25f / s;
} else {
tmp = s / (x * x);
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 4.999999987376214e-7) then
tmp = 0.25e0 / s
else
tmp = s / (x * x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(4.999999987376214e-7)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(s / Float32(x * x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(4.999999987376214e-7)) tmp = single(0.25) / s; else tmp = s / (x * x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.999999987376214 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{s}{x \cdot x}\\
\end{array}
\end{array}
if x < 4.99999999e-7Initial program 99.1%
Simplified99.2%
Taylor expanded in s around inf
/-lowering-/.f3238.3%
Simplified38.3%
if 4.99999999e-7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in s around inf
*-lowering-*.f32N/A
+-commutativeN/A
associate-+r+N/A
sum3-defineN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
sum3-undefineN/A
+-lft-identityN/A
+-lowering-+.f32N/A
Simplified88.2%
Taylor expanded in s around 0
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f3278.3%
Simplified78.3%
(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 99.3%
Simplified99.4%
Taylor expanded in s around inf
/-lowering-/.f3229.2%
Simplified29.2%
herbie shell --seed 2024288
(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))))))