
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
return 1.0f / (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)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
return 1.0f / (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)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}
(FPCore (x s) :precision binary32 (exp (- (log1p (exp (/ x (- s)))))))
float code(float x, float s) {
return expf(-log1pf(expf((x / -s))));
}
function code(x, s) return exp(Float32(-log1p(exp(Float32(x / Float32(-s)))))) end
\begin{array}{l}
\\
e^{-\mathsf{log1p}\left(e^{\frac{x}{-s}}\right)}
\end{array}
Initial program 99.8%
distribute-frac-neg99.8%
exp-neg99.8%
Applied egg-rr99.8%
add-exp-log99.8%
log-rec99.8%
log1p-expm1-u99.8%
log1p-define99.9%
expm1-log1p-u99.9%
rec-exp99.9%
distribute-neg-frac299.9%
Applied egg-rr99.9%
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (cbrt (exp (* (/ x s) -3.0))))))
float code(float x, float s) {
return 1.0f / (1.0f + cbrtf(expf(((x / s) * -3.0f))));
}
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + cbrt(exp(Float32(Float32(x / s) * Float32(-3.0)))))) end
\begin{array}{l}
\\
\frac{1}{1 + \sqrt[3]{e^{\frac{x}{s} \cdot -3}}}
\end{array}
Initial program 99.8%
distribute-frac-neg99.8%
exp-neg99.8%
Applied egg-rr99.8%
add-cbrt-cube99.8%
pow1/399.8%
pow399.8%
inv-pow99.8%
pow-pow99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow1/399.8%
Applied egg-rr99.8%
exp-prod99.9%
Simplified99.9%
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ x (- s))))))
float code(float x, float s) {
return 1.0f / (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)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(x / Float32(-s))))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((x / -s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{x}{-s}}}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x s)
:precision binary32
(if (<= x -49999998976.0)
(/ 1.0 (/ x s))
(if (<= x -2.9999999105145657e-35)
(/ 1.0 (/ (- 4.0 (* x (/ (/ x s) s))) (+ (/ x s) 2.0)))
(/ 1.0 (+ 1.0 (+ 1.0 (+ (/ 1.0 (+ 1.0 (/ x s))) -1.0)))))))
float code(float x, float s) {
float tmp;
if (x <= -49999998976.0f) {
tmp = 1.0f / (x / s);
} else if (x <= -2.9999999105145657e-35f) {
tmp = 1.0f / ((4.0f - (x * ((x / s) / s))) / ((x / s) + 2.0f));
} else {
tmp = 1.0f / (1.0f + (1.0f + ((1.0f / (1.0f + (x / s))) + -1.0f)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-49999998976.0e0)) then
tmp = 1.0e0 / (x / s)
else if (x <= (-2.9999999105145657e-35)) then
tmp = 1.0e0 / ((4.0e0 - (x * ((x / s) / s))) / ((x / s) + 2.0e0))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 + ((1.0e0 / (1.0e0 + (x / s))) + (-1.0e0))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-49999998976.0)) tmp = Float32(Float32(1.0) / Float32(x / s)); elseif (x <= Float32(-2.9999999105145657e-35)) tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) - Float32(x * Float32(Float32(x / s) / s))) / Float32(Float32(x / s) + Float32(2.0)))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))) + Float32(-1.0))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-49999998976.0)) tmp = single(1.0) / (x / s); elseif (x <= single(-2.9999999105145657e-35)) tmp = single(1.0) / ((single(4.0) - (x * ((x / s) / s))) / ((x / s) + single(2.0))); else tmp = single(1.0) / (single(1.0) + (single(1.0) + ((single(1.0) / (single(1.0) + (x / s))) + single(-1.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -49999998976:\\
\;\;\;\;\frac{1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq -2.9999999105145657 \cdot 10^{-35}:\\
\;\;\;\;\frac{1}{\frac{4 - x \cdot \frac{\frac{x}{s}}{s}}{\frac{x}{s} + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \left(1 + \left(\frac{1}{1 + \frac{x}{s}} + -1\right)\right)}\\
\end{array}
\end{array}
if x < -49999999000Initial program 100.0%
Taylor expanded in x around 0 78.4%
neg-mul-178.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in x around inf 72.5%
associate-*r/72.5%
neg-mul-172.5%
Simplified72.5%
clear-num78.4%
inv-pow78.4%
add-sqr-sqrt-0.0%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod78.4%
add-sqr-sqrt78.4%
Applied egg-rr78.4%
unpow-178.4%
Simplified78.4%
if -49999999000 < x < -2.99999991e-35Initial program 99.5%
Taylor expanded in x around 0 38.6%
neg-mul-138.6%
unsub-neg38.6%
Simplified38.6%
sub-neg38.6%
flip-+62.6%
metadata-eval62.6%
distribute-neg-frac262.6%
distribute-neg-frac262.6%
distribute-neg-frac262.6%
Applied egg-rr62.6%
distribute-frac-neg262.6%
distribute-frac-neg262.6%
sqr-neg62.6%
frac-2neg62.6%
associate-*r/62.6%
add-sqr-sqrt-0.0%
sqrt-unprod74.6%
sqr-neg74.6%
sqrt-unprod61.9%
add-sqr-sqrt61.9%
Applied egg-rr61.9%
*-commutative61.9%
*-un-lft-identity61.9%
times-frac70.3%
add-sqr-sqrt70.3%
sqrt-unprod67.9%
sqr-neg67.9%
sqrt-unprod-0.0%
add-sqr-sqrt71.0%
Applied egg-rr71.0%
if -2.99999991e-35 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 93.6%
+-commutative93.6%
Simplified93.6%
expm1-log1p-u93.6%
log1p-define93.6%
expm1-undefine93.6%
add-exp-log93.6%
+-commutative93.6%
Applied egg-rr93.6%
associate--l+93.7%
sub-neg93.7%
+-commutative93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification84.1%
(FPCore (x s)
:precision binary32
(if (<= x -49999998976.0)
(/ 1.0 (/ x s))
(if (<= x -2.9999999105145657e-35)
(/ 1.0 (/ (- 4.0 (/ x (* s (/ s x)))) (+ (/ x s) 2.0)))
(/ 1.0 (+ 1.0 (+ 1.0 (+ (/ 1.0 (+ 1.0 (/ x s))) -1.0)))))))
float code(float x, float s) {
float tmp;
if (x <= -49999998976.0f) {
tmp = 1.0f / (x / s);
} else if (x <= -2.9999999105145657e-35f) {
tmp = 1.0f / ((4.0f - (x / (s * (s / x)))) / ((x / s) + 2.0f));
} else {
tmp = 1.0f / (1.0f + (1.0f + ((1.0f / (1.0f + (x / s))) + -1.0f)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-49999998976.0e0)) then
tmp = 1.0e0 / (x / s)
else if (x <= (-2.9999999105145657e-35)) then
tmp = 1.0e0 / ((4.0e0 - (x / (s * (s / x)))) / ((x / s) + 2.0e0))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 + ((1.0e0 / (1.0e0 + (x / s))) + (-1.0e0))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-49999998976.0)) tmp = Float32(Float32(1.0) / Float32(x / s)); elseif (x <= Float32(-2.9999999105145657e-35)) tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) - Float32(x / Float32(s * Float32(s / x)))) / Float32(Float32(x / s) + Float32(2.0)))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))) + Float32(-1.0))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-49999998976.0)) tmp = single(1.0) / (x / s); elseif (x <= single(-2.9999999105145657e-35)) tmp = single(1.0) / ((single(4.0) - (x / (s * (s / x)))) / ((x / s) + single(2.0))); else tmp = single(1.0) / (single(1.0) + (single(1.0) + ((single(1.0) / (single(1.0) + (x / s))) + single(-1.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -49999998976:\\
\;\;\;\;\frac{1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq -2.9999999105145657 \cdot 10^{-35}:\\
\;\;\;\;\frac{1}{\frac{4 - \frac{x}{s \cdot \frac{s}{x}}}{\frac{x}{s} + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \left(1 + \left(\frac{1}{1 + \frac{x}{s}} + -1\right)\right)}\\
\end{array}
\end{array}
if x < -49999999000Initial program 100.0%
Taylor expanded in x around 0 78.4%
neg-mul-178.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in x around inf 72.5%
associate-*r/72.5%
neg-mul-172.5%
Simplified72.5%
clear-num78.4%
inv-pow78.4%
add-sqr-sqrt-0.0%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod78.4%
add-sqr-sqrt78.4%
Applied egg-rr78.4%
unpow-178.4%
Simplified78.4%
if -49999999000 < x < -2.99999991e-35Initial program 99.5%
Taylor expanded in x around 0 38.6%
neg-mul-138.6%
unsub-neg38.6%
Simplified38.6%
sub-neg38.6%
flip-+62.6%
metadata-eval62.6%
distribute-neg-frac262.6%
distribute-neg-frac262.6%
distribute-neg-frac262.6%
Applied egg-rr62.6%
distribute-frac-neg262.6%
distribute-frac-neg262.6%
sqr-neg62.6%
clear-num62.6%
frac-times66.1%
*-un-lft-identity66.1%
Applied egg-rr66.1%
if -2.99999991e-35 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 93.6%
+-commutative93.6%
Simplified93.6%
expm1-log1p-u93.6%
log1p-define93.6%
expm1-undefine93.6%
add-exp-log93.6%
+-commutative93.6%
Applied egg-rr93.6%
associate--l+93.7%
sub-neg93.7%
+-commutative93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification82.6%
(FPCore (x s)
:precision binary32
(if (<= x -49999998976.0)
(/ 1.0 (/ x s))
(if (<= x -1.999999943436137e-9)
(/ 1.0 (/ (- 4.0 (* (/ x s) (/ x s))) (/ x s)))
(/ 1.0 (+ 1.0 (+ 1.0 (+ (/ 1.0 (+ 1.0 (/ x s))) -1.0)))))))
float code(float x, float s) {
float tmp;
if (x <= -49999998976.0f) {
tmp = 1.0f / (x / s);
} else if (x <= -1.999999943436137e-9f) {
tmp = 1.0f / ((4.0f - ((x / s) * (x / s))) / (x / s));
} else {
tmp = 1.0f / (1.0f + (1.0f + ((1.0f / (1.0f + (x / s))) + -1.0f)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-49999998976.0e0)) then
tmp = 1.0e0 / (x / s)
else if (x <= (-1.999999943436137e-9)) then
tmp = 1.0e0 / ((4.0e0 - ((x / s) * (x / s))) / (x / s))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 + ((1.0e0 / (1.0e0 + (x / s))) + (-1.0e0))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-49999998976.0)) tmp = Float32(Float32(1.0) / Float32(x / s)); elseif (x <= Float32(-1.999999943436137e-9)) tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) - Float32(Float32(x / s) * Float32(x / s))) / Float32(x / s))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))) + Float32(-1.0))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-49999998976.0)) tmp = single(1.0) / (x / s); elseif (x <= single(-1.999999943436137e-9)) tmp = single(1.0) / ((single(4.0) - ((x / s) * (x / s))) / (x / s)); else tmp = single(1.0) / (single(1.0) + (single(1.0) + ((single(1.0) / (single(1.0) + (x / s))) + single(-1.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -49999998976:\\
\;\;\;\;\frac{1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq -1.999999943436137 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{4 - \frac{x}{s} \cdot \frac{x}{s}}{\frac{x}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \left(1 + \left(\frac{1}{1 + \frac{x}{s}} + -1\right)\right)}\\
\end{array}
\end{array}
if x < -49999999000Initial program 100.0%
Taylor expanded in x around 0 78.4%
neg-mul-178.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in x around inf 72.5%
associate-*r/72.5%
neg-mul-172.5%
Simplified72.5%
clear-num78.4%
inv-pow78.4%
add-sqr-sqrt-0.0%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod78.4%
add-sqr-sqrt78.4%
Applied egg-rr78.4%
unpow-178.4%
Simplified78.4%
if -49999999000 < x < -1.99999994e-9Initial program 99.5%
Taylor expanded in x around 0 17.2%
neg-mul-117.2%
unsub-neg17.2%
Simplified17.2%
sub-neg17.2%
flip-+61.6%
metadata-eval61.6%
distribute-neg-frac261.6%
distribute-neg-frac261.6%
distribute-neg-frac261.6%
Applied egg-rr61.6%
Taylor expanded in x around inf 57.6%
if -1.99999994e-9 < x Initial program 99.9%
distribute-frac-neg99.9%
exp-neg99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 86.3%
+-commutative86.3%
Simplified86.3%
expm1-log1p-u86.3%
log1p-define86.3%
expm1-undefine86.3%
add-exp-log86.3%
+-commutative86.3%
Applied egg-rr86.3%
associate--l+86.4%
sub-neg86.4%
+-commutative86.4%
metadata-eval86.4%
Simplified86.4%
Final simplification80.5%
(FPCore (x s)
:precision binary32
(if (<= x -49999998976.0)
(/ 1.0 (/ x s))
(if (<= x -1.0000000116860974e-7)
(/ 1.0 (/ (+ 4.0 (/ (* x (/ x s)) s)) (/ x s)))
(/ 1.0 (+ 1.0 (+ 1.0 (+ (/ 1.0 (+ 1.0 (/ x s))) -1.0)))))))
float code(float x, float s) {
float tmp;
if (x <= -49999998976.0f) {
tmp = 1.0f / (x / s);
} else if (x <= -1.0000000116860974e-7f) {
tmp = 1.0f / ((4.0f + ((x * (x / s)) / s)) / (x / s));
} else {
tmp = 1.0f / (1.0f + (1.0f + ((1.0f / (1.0f + (x / s))) + -1.0f)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-49999998976.0e0)) then
tmp = 1.0e0 / (x / s)
else if (x <= (-1.0000000116860974e-7)) then
tmp = 1.0e0 / ((4.0e0 + ((x * (x / s)) / s)) / (x / s))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 + ((1.0e0 / (1.0e0 + (x / s))) + (-1.0e0))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-49999998976.0)) tmp = Float32(Float32(1.0) / Float32(x / s)); elseif (x <= Float32(-1.0000000116860974e-7)) tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) + Float32(Float32(x * Float32(x / s)) / s)) / Float32(x / s))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))) + Float32(-1.0))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-49999998976.0)) tmp = single(1.0) / (x / s); elseif (x <= single(-1.0000000116860974e-7)) tmp = single(1.0) / ((single(4.0) + ((x * (x / s)) / s)) / (x / s)); else tmp = single(1.0) / (single(1.0) + (single(1.0) + ((single(1.0) / (single(1.0) + (x / s))) + single(-1.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -49999998976:\\
\;\;\;\;\frac{1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq -1.0000000116860974 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\frac{4 + \frac{x \cdot \frac{x}{s}}{s}}{\frac{x}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \left(1 + \left(\frac{1}{1 + \frac{x}{s}} + -1\right)\right)}\\
\end{array}
\end{array}
if x < -49999999000Initial program 100.0%
Taylor expanded in x around 0 78.4%
neg-mul-178.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in x around inf 72.5%
associate-*r/72.5%
neg-mul-172.5%
Simplified72.5%
clear-num78.4%
inv-pow78.4%
add-sqr-sqrt-0.0%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod78.4%
add-sqr-sqrt78.4%
Applied egg-rr78.4%
unpow-178.4%
Simplified78.4%
if -49999999000 < x < -1.00000001e-7Initial program 99.7%
Taylor expanded in x around 0 15.3%
neg-mul-115.3%
unsub-neg15.3%
Simplified15.3%
sub-neg15.3%
flip-+62.2%
metadata-eval62.2%
distribute-neg-frac262.2%
distribute-neg-frac262.2%
distribute-neg-frac262.2%
Applied egg-rr62.2%
distribute-frac-neg262.2%
distribute-frac-neg262.2%
sqr-neg62.2%
frac-2neg62.2%
associate-*r/62.2%
add-sqr-sqrt-0.0%
sqrt-unprod61.8%
sqr-neg61.8%
sqrt-unprod61.8%
add-sqr-sqrt61.8%
Applied egg-rr61.8%
Taylor expanded in x around inf 60.1%
if -1.00000001e-7 < x Initial program 99.8%
distribute-frac-neg99.8%
exp-neg99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 85.1%
+-commutative85.1%
Simplified85.1%
expm1-log1p-u85.1%
log1p-define85.1%
expm1-undefine85.1%
add-exp-log85.1%
+-commutative85.1%
Applied egg-rr85.1%
associate--l+85.1%
sub-neg85.1%
+-commutative85.1%
metadata-eval85.1%
Simplified85.1%
Final simplification80.4%
(FPCore (x s) :precision binary32 (if (<= x -2.9999999105145657e-35) (/ 1.0 (+ 2.0 (* x (/ -1.0 s)))) (/ 1.0 (+ 1.0 (+ 1.0 (+ (/ 1.0 (+ 1.0 (/ x s))) -1.0))))))
float code(float x, float s) {
float tmp;
if (x <= -2.9999999105145657e-35f) {
tmp = 1.0f / (2.0f + (x * (-1.0f / s)));
} else {
tmp = 1.0f / (1.0f + (1.0f + ((1.0f / (1.0f + (x / s))) + -1.0f)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-2.9999999105145657e-35)) then
tmp = 1.0e0 / (2.0e0 + (x * ((-1.0e0) / s)))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 + ((1.0e0 / (1.0e0 + (x / s))) + (-1.0e0))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-2.9999999105145657e-35)) tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(-1.0) / s)))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) + Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))) + Float32(-1.0))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-2.9999999105145657e-35)) tmp = single(1.0) / (single(2.0) + (x * (single(-1.0) / s))); else tmp = single(1.0) / (single(1.0) + (single(1.0) + ((single(1.0) / (single(1.0) + (x / s))) + single(-1.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9999999105145657 \cdot 10^{-35}:\\
\;\;\;\;\frac{1}{2 + x \cdot \frac{-1}{s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \left(1 + \left(\frac{1}{1 + \frac{x}{s}} + -1\right)\right)}\\
\end{array}
\end{array}
if x < -2.99999991e-35Initial program 99.7%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
unsub-neg54.0%
Simplified54.0%
clear-num54.0%
associate-/r/54.0%
Applied egg-rr54.0%
if -2.99999991e-35 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 93.6%
+-commutative93.6%
Simplified93.6%
expm1-log1p-u93.6%
log1p-define93.6%
expm1-undefine93.6%
add-exp-log93.6%
+-commutative93.6%
Applied egg-rr93.6%
associate--l+93.7%
sub-neg93.7%
+-commutative93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification74.5%
(FPCore (x s)
:precision binary32
(if (<= x -0.004999999888241291)
(/ -1.0 (/ x s))
(if (<= x 4.00000018325482e-18)
(+ 0.5 (/ (* x 0.25) s))
(/ 1.0 (+ 1.0 (/ s x))))))
float code(float x, float s) {
float tmp;
if (x <= -0.004999999888241291f) {
tmp = -1.0f / (x / s);
} else if (x <= 4.00000018325482e-18f) {
tmp = 0.5f + ((x * 0.25f) / s);
} else {
tmp = 1.0f / (1.0f + (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 <= (-0.004999999888241291e0)) then
tmp = (-1.0e0) / (x / s)
else if (x <= 4.00000018325482e-18) then
tmp = 0.5e0 + ((x * 0.25e0) / s)
else
tmp = 1.0e0 / (1.0e0 + (s / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.004999999888241291)) tmp = Float32(Float32(-1.0) / Float32(x / s)); elseif (x <= Float32(4.00000018325482e-18)) tmp = Float32(Float32(0.5) + Float32(Float32(x * Float32(0.25)) / s)); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(s / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.004999999888241291)) tmp = single(-1.0) / (x / s); elseif (x <= single(4.00000018325482e-18)) tmp = single(0.5) + ((x * single(0.25)) / s); else tmp = single(1.0) / (single(1.0) + (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004999999888241291:\\
\;\;\;\;\frac{-1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq 4.00000018325482 \cdot 10^{-18}:\\
\;\;\;\;0.5 + \frac{x \cdot 0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{s}{x}}\\
\end{array}
\end{array}
if x < -0.00499999989Initial program 99.9%
Taylor expanded in x around 0 54.4%
neg-mul-154.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
if -0.00499999989 < x < 4.00000018e-18Initial program 99.6%
Taylor expanded in x around 0 62.1%
associate-*r/62.1%
Simplified62.1%
if 4.00000018e-18 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in x around inf 90.3%
Final simplification69.9%
(FPCore (x s) :precision binary32 (if (<= x -0.004999999888241291) (/ -1.0 (/ x s)) (if (<= x 4.000000014509975e-15) (+ 0.5 (/ (* x 0.25) s)) (- 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= -0.004999999888241291f) {
tmp = -1.0f / (x / s);
} else if (x <= 4.000000014509975e-15f) {
tmp = 0.5f + ((x * 0.25f) / s);
} else {
tmp = 1.0f - (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 <= (-0.004999999888241291e0)) then
tmp = (-1.0e0) / (x / s)
else if (x <= 4.000000014509975e-15) then
tmp = 0.5e0 + ((x * 0.25e0) / s)
else
tmp = 1.0e0 - (s / x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.004999999888241291)) tmp = Float32(Float32(-1.0) / Float32(x / s)); elseif (x <= Float32(4.000000014509975e-15)) tmp = Float32(Float32(0.5) + Float32(Float32(x * Float32(0.25)) / s)); else tmp = Float32(Float32(1.0) - Float32(s / x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.004999999888241291)) tmp = single(-1.0) / (x / s); elseif (x <= single(4.000000014509975e-15)) tmp = single(0.5) + ((x * single(0.25)) / s); else tmp = single(1.0) - (s / x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004999999888241291:\\
\;\;\;\;\frac{-1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq 4.000000014509975 \cdot 10^{-15}:\\
\;\;\;\;0.5 + \frac{x \cdot 0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{s}{x}\\
\end{array}
\end{array}
if x < -0.00499999989Initial program 99.9%
Taylor expanded in x around 0 54.4%
neg-mul-154.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
if -0.00499999989 < x < 4.00000001e-15Initial program 99.6%
Taylor expanded in x around 0 61.2%
associate-*r/61.2%
Simplified61.2%
if 4.00000001e-15 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around inf 91.9%
neg-mul-191.9%
unsub-neg91.9%
Simplified91.9%
Final simplification69.5%
(FPCore (x s) :precision binary32 (if (<= x -2.9999999105145657e-35) (/ 1.0 (+ 2.0 (* x (/ -1.0 s)))) (/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ x s)))))))
float code(float x, float s) {
float tmp;
if (x <= -2.9999999105145657e-35f) {
tmp = 1.0f / (2.0f + (x * (-1.0f / s)));
} else {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + (x / 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.9999999105145657e-35)) then
tmp = 1.0e0 / (2.0e0 + (x * ((-1.0e0) / s)))
else
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + (x / s))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-2.9999999105145657e-35)) tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(-1.0) / s)))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-2.9999999105145657e-35)) tmp = single(1.0) / (single(2.0) + (x * (single(-1.0) / s))); else tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + (x / s)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9999999105145657 \cdot 10^{-35}:\\
\;\;\;\;\frac{1}{2 + x \cdot \frac{-1}{s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\
\end{array}
\end{array}
if x < -2.99999991e-35Initial program 99.7%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
unsub-neg54.0%
Simplified54.0%
clear-num54.0%
associate-/r/54.0%
Applied egg-rr54.0%
if -2.99999991e-35 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 93.6%
+-commutative93.6%
Simplified93.6%
Final simplification74.4%
(FPCore (x s) :precision binary32 (if (<= x -0.004999999888241291) (/ -1.0 (/ x s)) (if (<= x 4.000000014509975e-15) 0.5 (- 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= -0.004999999888241291f) {
tmp = -1.0f / (x / s);
} else if (x <= 4.000000014509975e-15f) {
tmp = 0.5f;
} else {
tmp = 1.0f - (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 <= (-0.004999999888241291e0)) then
tmp = (-1.0e0) / (x / s)
else if (x <= 4.000000014509975e-15) then
tmp = 0.5e0
else
tmp = 1.0e0 - (s / x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.004999999888241291)) tmp = Float32(Float32(-1.0) / Float32(x / s)); elseif (x <= Float32(4.000000014509975e-15)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) - Float32(s / x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.004999999888241291)) tmp = single(-1.0) / (x / s); elseif (x <= single(4.000000014509975e-15)) tmp = single(0.5); else tmp = single(1.0) - (s / x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004999999888241291:\\
\;\;\;\;\frac{-1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq 4.000000014509975 \cdot 10^{-15}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{s}{x}\\
\end{array}
\end{array}
if x < -0.00499999989Initial program 99.9%
Taylor expanded in x around 0 54.4%
neg-mul-154.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
if -0.00499999989 < x < 4.00000001e-15Initial program 99.6%
Taylor expanded in x around 0 59.8%
if 4.00000001e-15 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around inf 91.9%
neg-mul-191.9%
unsub-neg91.9%
Simplified91.9%
Final simplification68.9%
(FPCore (x s) :precision binary32 (if (<= x -0.009999999776482582) (/ 1.0 (/ x s)) (if (<= x 4.000000014509975e-15) 0.5 (- 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= -0.009999999776482582f) {
tmp = 1.0f / (x / s);
} else if (x <= 4.000000014509975e-15f) {
tmp = 0.5f;
} else {
tmp = 1.0f - (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 <= (-0.009999999776482582e0)) then
tmp = 1.0e0 / (x / s)
else if (x <= 4.000000014509975e-15) then
tmp = 0.5e0
else
tmp = 1.0e0 - (s / x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.009999999776482582)) tmp = Float32(Float32(1.0) / Float32(x / s)); elseif (x <= Float32(4.000000014509975e-15)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) - Float32(s / x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.009999999776482582)) tmp = single(1.0) / (x / s); elseif (x <= single(4.000000014509975e-15)) tmp = single(0.5); else tmp = single(1.0) - (s / x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.009999999776482582:\\
\;\;\;\;\frac{1}{\frac{x}{s}}\\
\mathbf{elif}\;x \leq 4.000000014509975 \cdot 10^{-15}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{s}{x}\\
\end{array}
\end{array}
if x < -0.00999999978Initial program 100.0%
Taylor expanded in x around 0 56.1%
neg-mul-156.1%
unsub-neg56.1%
Simplified56.1%
Taylor expanded in x around inf 51.6%
associate-*r/51.6%
neg-mul-151.6%
Simplified51.6%
clear-num56.1%
inv-pow56.1%
add-sqr-sqrt-0.0%
sqrt-unprod65.2%
sqr-neg65.2%
sqrt-unprod56.1%
add-sqr-sqrt56.1%
Applied egg-rr56.1%
unpow-156.1%
Simplified56.1%
if -0.00999999978 < x < 4.00000001e-15Initial program 99.5%
Taylor expanded in x around 0 58.2%
if 4.00000001e-15 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around inf 91.9%
neg-mul-191.9%
unsub-neg91.9%
Simplified91.9%
(FPCore (x s) :precision binary32 (if (<= x -0.004999999888241291) (/ (- s) x) (if (<= x 4.000000014509975e-15) 0.5 (- 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= -0.004999999888241291f) {
tmp = -s / x;
} else if (x <= 4.000000014509975e-15f) {
tmp = 0.5f;
} else {
tmp = 1.0f - (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 <= (-0.004999999888241291e0)) then
tmp = -s / x
else if (x <= 4.000000014509975e-15) then
tmp = 0.5e0
else
tmp = 1.0e0 - (s / x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.004999999888241291)) tmp = Float32(Float32(-s) / x); elseif (x <= Float32(4.000000014509975e-15)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) - Float32(s / x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.004999999888241291)) tmp = -s / x; elseif (x <= single(4.000000014509975e-15)) tmp = single(0.5); else tmp = single(1.0) - (s / x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004999999888241291:\\
\;\;\;\;\frac{-s}{x}\\
\mathbf{elif}\;x \leq 4.000000014509975 \cdot 10^{-15}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{s}{x}\\
\end{array}
\end{array}
if x < -0.00499999989Initial program 99.9%
Taylor expanded in x around 0 54.4%
neg-mul-154.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in x around inf 50.1%
associate-*r/50.1%
neg-mul-150.1%
Simplified50.1%
if -0.00499999989 < x < 4.00000001e-15Initial program 99.6%
Taylor expanded in x around 0 59.8%
if 4.00000001e-15 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around inf 91.9%
neg-mul-191.9%
unsub-neg91.9%
Simplified91.9%
(FPCore (x s) :precision binary32 (if (<= x 4.00000018325482e-18) (/ 1.0 (+ -1.0 (- 3.0 (/ x s)))) (/ 1.0 (+ 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= 4.00000018325482e-18f) {
tmp = 1.0f / (-1.0f + (3.0f - (x / s)));
} else {
tmp = 1.0f / (1.0f + (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.00000018325482e-18) then
tmp = 1.0e0 / ((-1.0e0) + (3.0e0 - (x / s)))
else
tmp = 1.0e0 / (1.0e0 + (s / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(4.00000018325482e-18)) tmp = Float32(Float32(1.0) / Float32(Float32(-1.0) + Float32(Float32(3.0) - Float32(x / s)))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(s / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(4.00000018325482e-18)) tmp = single(1.0) / (single(-1.0) + (single(3.0) - (x / s))); else tmp = single(1.0) / (single(1.0) + (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.00000018325482 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{-1 + \left(3 - \frac{x}{s}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{s}{x}}\\
\end{array}
\end{array}
if x < 4.00000018e-18Initial program 99.7%
Taylor expanded in x around 0 57.6%
neg-mul-157.6%
unsub-neg57.6%
Simplified57.6%
expm1-log1p-u57.4%
Applied egg-rr57.4%
expm1-undefine57.4%
sub-neg57.4%
log1p-undefine57.4%
rem-exp-log57.7%
associate-+r-57.7%
metadata-eval57.7%
metadata-eval57.7%
Simplified57.7%
if 4.00000018e-18 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in x around inf 90.3%
Final simplification69.4%
(FPCore (x s) :precision binary32 (if (<= x 4.00000018325482e-18) (/ 1.0 (- 2.0 (/ x s))) (/ 1.0 (+ 1.0 (/ s x)))))
float code(float x, float s) {
float tmp;
if (x <= 4.00000018325482e-18f) {
tmp = 1.0f / (2.0f - (x / s));
} else {
tmp = 1.0f / (1.0f + (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.00000018325482e-18) then
tmp = 1.0e0 / (2.0e0 - (x / s))
else
tmp = 1.0e0 / (1.0e0 + (s / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(4.00000018325482e-18)) tmp = Float32(Float32(1.0) / Float32(Float32(2.0) - Float32(x / s))); else tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(s / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(4.00000018325482e-18)) tmp = single(1.0) / (single(2.0) - (x / s)); else tmp = single(1.0) / (single(1.0) + (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.00000018325482 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{2 - \frac{x}{s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{s}{x}}\\
\end{array}
\end{array}
if x < 4.00000018e-18Initial program 99.7%
Taylor expanded in x around 0 57.6%
neg-mul-157.6%
unsub-neg57.6%
Simplified57.6%
if 4.00000018e-18 < x Initial program 100.0%
distribute-frac-neg100.0%
exp-neg99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in x around inf 90.3%
(FPCore (x s) :precision binary32 (if (<= x -0.004999999888241291) (/ (- s) x) 0.5))
float code(float x, float s) {
float tmp;
if (x <= -0.004999999888241291f) {
tmp = -s / x;
} else {
tmp = 0.5f;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-0.004999999888241291e0)) then
tmp = -s / x
else
tmp = 0.5e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.004999999888241291)) tmp = Float32(Float32(-s) / x); else tmp = Float32(0.5); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.004999999888241291)) tmp = -s / x; else tmp = single(0.5); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004999999888241291:\\
\;\;\;\;\frac{-s}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5\\
\end{array}
\end{array}
if x < -0.00499999989Initial program 99.9%
Taylor expanded in x around 0 54.4%
neg-mul-154.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in x around inf 50.1%
associate-*r/50.1%
neg-mul-150.1%
Simplified50.1%
if -0.00499999989 < x Initial program 99.8%
Taylor expanded in x around 0 45.3%
(FPCore (x s) :precision binary32 (if (<= x -0.009999999776482582) (/ s x) 0.5))
float code(float x, float s) {
float tmp;
if (x <= -0.009999999776482582f) {
tmp = s / x;
} else {
tmp = 0.5f;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-0.009999999776482582e0)) then
tmp = s / x
else
tmp = 0.5e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-0.009999999776482582)) tmp = Float32(s / x); else tmp = Float32(0.5); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-0.009999999776482582)) tmp = s / x; else tmp = single(0.5); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.009999999776482582:\\
\;\;\;\;\frac{s}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5\\
\end{array}
\end{array}
if x < -0.00999999978Initial program 100.0%
Taylor expanded in x around 0 56.1%
neg-mul-156.1%
unsub-neg56.1%
Simplified56.1%
Taylor expanded in x around inf 51.6%
associate-*r/51.6%
neg-mul-151.6%
Simplified51.6%
div-inv51.6%
add-sqr-sqrt-0.0%
sqrt-unprod62.0%
sqr-neg62.0%
sqrt-unprod51.6%
add-sqr-sqrt51.6%
Applied egg-rr51.6%
associate-*r/51.6%
*-rgt-identity51.6%
Simplified51.6%
if -0.00999999978 < x Initial program 99.7%
Taylor expanded in x around 0 44.7%
(FPCore (x s) :precision binary32 0.5)
float code(float x, float s) {
return 0.5f;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 0.5e0
end function
function code(x, s) return Float32(0.5) end
function tmp = code(x, s) tmp = single(0.5); end
\begin{array}{l}
\\
0.5
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 33.6%
herbie shell --seed 2024143
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))