
(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 23 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 (let* ((t_0 (/ (fabs x) s))) (/ 1.0 (/ (pow (+ 1.0 (exp (- t_0))) 2.0) (/ (pow (exp -1.0) t_0) s)))))
float code(float x, float s) {
float t_0 = fabsf(x) / s;
return 1.0f / (powf((1.0f + expf(-t_0)), 2.0f) / (powf(expf(-1.0f), t_0) / s));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
t_0 = abs(x) / s
code = 1.0e0 / (((1.0e0 + exp(-t_0)) ** 2.0e0) / ((exp((-1.0e0)) ** t_0) / s))
end function
function code(x, s) t_0 = Float32(abs(x) / s) return Float32(Float32(1.0) / Float32((Float32(Float32(1.0) + exp(Float32(-t_0))) ^ Float32(2.0)) / Float32((exp(Float32(-1.0)) ^ t_0) / s))) end
function tmp = code(x, s) t_0 = abs(x) / s; tmp = single(1.0) / (((single(1.0) + exp(-t_0)) ^ single(2.0)) / ((exp(single(-1.0)) ^ t_0) / s)); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left|x\right|}{s}\\
\frac{1}{\frac{{\left(1 + e^{-t\_0}\right)}^{2}}{\frac{{\left(e^{-1}\right)}^{t\_0}}{s}}}
\end{array}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
lift-fabs.f32N/A
lift-/.f32N/A
neg-mul-1N/A
exp-prodN/A
lower-pow.f32N/A
lower-exp.f3299.0
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 4.999999841327613e-22)
(/ t_0 s)
(/ 1.0 (fma x (/ x s) (* s 4.0))))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22f) {
tmp = t_0 / s;
} else {
tmp = 1.0f / fmaf(x, (x / s), (s * 4.0f));
}
return tmp;
}
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(4.999999841327613e-22)) tmp = Float32(t_0 / s); else tmp = Float32(Float32(1.0) / fma(x, Float32(x / s), Float32(s * Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 4.999999841327613 \cdot 10^{-22}:\\
\;\;\;\;\frac{t\_0}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(x, \frac{x}{s}, s \cdot 4\right)}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 4.9999998e-22Initial program 99.0%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Applied egg-rr99.0%
Taylor expanded in s around 0
neg-mul-1N/A
distribute-neg-frac2N/A
lower-/.f32N/A
lower-fabs.f32N/A
lower-neg.f3299.0
Simplified99.0%
if 4.9999998e-22 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.7%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.1%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3280.3
Simplified80.3%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
Applied egg-rr94.0%
Final simplification97.9%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 4.999999841327613e-22)
t_0
(/ 1.0 (fma x (/ x s) (* s 4.0))))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22f) {
tmp = t_0;
} else {
tmp = 1.0f / fmaf(x, (x / s), (s * 4.0f));
}
return tmp;
}
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(4.999999841327613e-22)) tmp = t_0; else tmp = Float32(Float32(1.0) / fma(x, Float32(x / s), Float32(s * Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 4.999999841327613 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(x, \frac{x}{s}, s \cdot 4\right)}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 4.9999998e-22Initial program 99.0%
Applied egg-rr99.7%
Taylor expanded in s around 0
neg-mul-1N/A
lower-neg.f32N/A
lower-/.f32N/A
lower-fabs.f3298.4
Simplified98.4%
if 4.9999998e-22 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.7%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.1%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3280.3
Simplified80.3%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
Applied egg-rr94.0%
Final simplification97.4%
(FPCore (x s) :precision binary32 (let* ((t_0 (/ (fabs x) s))) (/ (pow (exp -1.0) t_0) (* s (pow (+ 1.0 (exp (- t_0))) 2.0)))))
float code(float x, float s) {
float t_0 = fabsf(x) / s;
return powf(expf(-1.0f), t_0) / (s * powf((1.0f + expf(-t_0)), 2.0f));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
t_0 = abs(x) / s
code = (exp((-1.0e0)) ** t_0) / (s * ((1.0e0 + exp(-t_0)) ** 2.0e0))
end function
function code(x, s) t_0 = Float32(abs(x) / s) return Float32((exp(Float32(-1.0)) ^ t_0) / Float32(s * (Float32(Float32(1.0) + exp(Float32(-t_0))) ^ Float32(2.0)))) end
function tmp = code(x, s) t_0 = abs(x) / s; tmp = (exp(single(-1.0)) ^ t_0) / (s * ((single(1.0) + exp(-t_0)) ^ single(2.0))); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left|x\right|}{s}\\
\frac{{\left(e^{-1}\right)}^{t\_0}}{s \cdot {\left(1 + e^{-t\_0}\right)}^{2}}
\end{array}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
lift-+.f32N/A
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
Applied egg-rr99.0%
lift-fabs.f32N/A
distribute-frac-negN/A
lift-/.f32N/A
neg-mul-1N/A
exp-prodN/A
lower-pow.f32N/A
lower-exp.f3299.0
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 0.0)
(/ 1.0 (* s (/ (* x x) (* s s))))
(/ 1.0 (fma x (/ x s) (* s 4.0))))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 0.0f) {
tmp = 1.0f / (s * ((x * x) / (s * s)));
} else {
tmp = 1.0f / fmaf(x, (x / s), (s * 4.0f));
}
return tmp;
}
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(0.0)) tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(x * x) / Float32(s * s)))); else tmp = Float32(Float32(1.0) / fma(x, Float32(x / s), Float32(s * Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\
\;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(x, \frac{x}{s}, s \cdot 4\right)}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 0.0Initial program 99.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.1%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
Taylor expanded in x around inf
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
if 0.0 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.5%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr98.8%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
Applied egg-rr91.2%
Final simplification81.1%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 4.999999841327613e-22)
(/ 1.0 (/ x (/ s x)))
(/ 0.25 s))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22f) {
tmp = 1.0f / (x / (s / x));
} else {
tmp = 0.25f / s;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
real(4) :: tmp
t_0 = exp(-(abs(x) / s))
t_1 = 1.0e0 + t_0
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22) then
tmp = 1.0e0 / (x / (s / x))
else
tmp = 0.25e0 / s
end if
code = tmp
end function
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(4.999999841327613e-22)) tmp = Float32(Float32(1.0) / Float32(x / Float32(s / x))); else tmp = Float32(Float32(0.25) / s); end return tmp end
function tmp_2 = code(x, s) t_0 = exp(-(abs(x) / s)); t_1 = single(1.0) + t_0; tmp = single(0.0); if ((t_0 / (t_1 * (s * t_1))) <= single(4.999999841327613e-22)) tmp = single(1.0) / (x / (s / x)); else tmp = single(0.25) / s; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 4.999999841327613 \cdot 10^{-22}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{s}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{s}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 4.9999998e-22Initial program 99.0%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.2
Simplified77.2%
Taylor expanded in s around 0
lower-/.f32N/A
unpow2N/A
lower-*.f3256.8
Simplified56.8%
associate-/r*N/A
clear-numN/A
lower-/.f32N/A
lower-/.f32N/A
lower-/.f3258.4
Applied egg-rr58.4%
if 4.9999998e-22 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.7%
Taylor expanded in s around inf
lower-/.f3291.7
Simplified91.7%
Final simplification66.1%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 4.999999841327613e-22)
(/ 1.0 (/ (* x x) s))
(/ 0.25 s))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22f) {
tmp = 1.0f / ((x * x) / s);
} else {
tmp = 0.25f / s;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
real(4) :: tmp
t_0 = exp(-(abs(x) / s))
t_1 = 1.0e0 + t_0
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22) then
tmp = 1.0e0 / ((x * x) / s)
else
tmp = 0.25e0 / s
end if
code = tmp
end function
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(4.999999841327613e-22)) tmp = Float32(Float32(1.0) / Float32(Float32(x * x) / s)); else tmp = Float32(Float32(0.25) / s); end return tmp end
function tmp_2 = code(x, s) t_0 = exp(-(abs(x) / s)); t_1 = single(1.0) + t_0; tmp = single(0.0); if ((t_0 / (t_1 * (s * t_1))) <= single(4.999999841327613e-22)) tmp = single(1.0) / ((x * x) / s); else tmp = single(0.25) / s; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 4.999999841327613 \cdot 10^{-22}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x}{s}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{s}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 4.9999998e-22Initial program 99.0%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.2
Simplified77.2%
Taylor expanded in s around 0
lower-/.f32N/A
unpow2N/A
lower-*.f3258.4
Simplified58.4%
if 4.9999998e-22 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.7%
Taylor expanded in s around inf
lower-/.f3291.7
Simplified91.7%
Final simplification66.0%
(FPCore (x s)
:precision binary32
(let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
(if (<= (/ t_0 (* t_1 (* s t_1))) 4.999999841327613e-22)
(/ s (* x x))
(/ 0.25 s))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
float t_1 = 1.0f + t_0;
float tmp;
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22f) {
tmp = s / (x * x);
} else {
tmp = 0.25f / s;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
real(4) :: tmp
t_0 = exp(-(abs(x) / s))
t_1 = 1.0e0 + t_0
if ((t_0 / (t_1 * (s * t_1))) <= 4.999999841327613e-22) then
tmp = s / (x * x)
else
tmp = 0.25e0 / s
end if
code = tmp
end function
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) t_1 = Float32(Float32(1.0) + t_0) tmp = Float32(0.0) if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(4.999999841327613e-22)) tmp = Float32(s / Float32(x * x)); else tmp = Float32(Float32(0.25) / s); end return tmp end
function tmp_2 = code(x, s) t_0 = exp(-(abs(x) / s)); t_1 = single(1.0) + t_0; tmp = single(0.0); if ((t_0 / (t_1 * (s * t_1))) <= single(4.999999841327613e-22)) tmp = s / (x * x); else tmp = single(0.25) / s; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 4.999999841327613 \cdot 10^{-22}:\\
\;\;\;\;\frac{s}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{s}\\
\end{array}
\end{array}
if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 4.9999998e-22Initial program 99.0%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.2
Simplified77.2%
Taylor expanded in s around 0
lower-/.f32N/A
unpow2N/A
lower-*.f3256.8
Simplified56.8%
if 4.9999998e-22 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) Initial program 98.7%
Taylor expanded in s around inf
lower-/.f3291.7
Simplified91.7%
Final simplification64.8%
(FPCore (x s) :precision binary32 (let* ((t_0 (exp (- (/ (fabs x) s))))) (/ 1.0 (/ (pow (+ 1.0 t_0) 2.0) (/ t_0 s)))))
float code(float x, float s) {
float t_0 = expf(-(fabsf(x) / s));
return 1.0f / (powf((1.0f + t_0), 2.0f) / (t_0 / s));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
t_0 = exp(-(abs(x) / s))
code = 1.0e0 / (((1.0e0 + t_0) ** 2.0e0) / (t_0 / s))
end function
function code(x, s) t_0 = exp(Float32(-Float32(abs(x) / s))) return Float32(Float32(1.0) / Float32((Float32(Float32(1.0) + t_0) ^ Float32(2.0)) / Float32(t_0 / s))) end
function tmp = code(x, s) t_0 = exp(-(abs(x) / s)); tmp = single(1.0) / (((single(1.0) + t_0) ^ single(2.0)) / (t_0 / s)); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\frac{\left|x\right|}{s}}\\
\frac{1}{\frac{{\left(1 + t\_0\right)}^{2}}{\frac{t\_0}{s}}}
\end{array}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x s) :precision binary32 (let* ((t_0 (- (/ (fabs x) s)))) (/ (exp (fma (log1p (exp t_0)) -2.0 t_0)) s)))
float code(float x, float s) {
float t_0 = -(fabsf(x) / s);
return expf(fmaf(log1pf(expf(t_0)), -2.0f, t_0)) / s;
}
function code(x, s) t_0 = Float32(-Float32(abs(x) / s)) return Float32(exp(fma(log1p(exp(t_0)), Float32(-2.0), t_0)) / s) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{\left|x\right|}{s}\\
\frac{e^{\mathsf{fma}\left(\mathsf{log1p}\left(e^{t\_0}\right), -2, t\_0\right)}}{s}
\end{array}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x s) :precision binary32 (let* ((t_0 (/ (fabs x) s))) (/ (exp (- t_0)) (* s (pow (- 2.0 t_0) 2.0)))))
float code(float x, float s) {
float t_0 = fabsf(x) / s;
return expf(-t_0) / (s * powf((2.0f - t_0), 2.0f));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
t_0 = abs(x) / s
code = exp(-t_0) / (s * ((2.0e0 - t_0) ** 2.0e0))
end function
function code(x, s) t_0 = Float32(abs(x) / s) return Float32(exp(Float32(-t_0)) / Float32(s * (Float32(Float32(2.0) - t_0) ^ Float32(2.0)))) end
function tmp = code(x, s) t_0 = abs(x) / s; tmp = exp(-t_0) / (s * ((single(2.0) - t_0) ^ single(2.0))); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left|x\right|}{s}\\
\frac{e^{-t\_0}}{s \cdot {\left(2 - t\_0\right)}^{2}}
\end{array}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
lift-+.f32N/A
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
Applied egg-rr99.0%
Taylor expanded in s around inf
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower-fabs.f3296.7
Simplified96.7%
Final simplification96.7%
(FPCore (x s) :precision binary32 (/ 1.0 (/ 4.0 (/ (pow (exp -1.0) (/ (fabs x) s)) s))))
float code(float x, float s) {
return 1.0f / (4.0f / (powf(expf(-1.0f), (fabsf(x) / s)) / s));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (4.0e0 / ((exp((-1.0e0)) ** (abs(x) / s)) / s))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(4.0) / Float32((exp(Float32(-1.0)) ^ Float32(abs(x) / s)) / s))) end
function tmp = code(x, s) tmp = single(1.0) / (single(4.0) / ((exp(single(-1.0)) ^ (abs(x) / s)) / s)); end
\begin{array}{l}
\\
\frac{1}{\frac{4}{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{s}}}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
lift-fabs.f32N/A
lift-/.f32N/A
neg-mul-1N/A
exp-prodN/A
lower-pow.f32N/A
lower-exp.f3299.0
Applied egg-rr99.0%
Taylor expanded in s around inf
Simplified95.4%
(FPCore (x s) :precision binary32 (/ 1.0 (/ 4.0 (/ (exp (- (/ (fabs x) s))) s))))
float code(float x, float s) {
return 1.0f / (4.0f / (expf(-(fabsf(x) / s)) / s));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (4.0e0 / (exp(-(abs(x) / s)) / s))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(4.0) / Float32(exp(Float32(-Float32(abs(x) / s))) / s))) end
function tmp = code(x, s) tmp = single(1.0) / (single(4.0) / (exp(-(abs(x) / s)) / s)); end
\begin{array}{l}
\\
\frac{1}{\frac{4}{\frac{e^{-\frac{\left|x\right|}{s}}}{s}}}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
Simplified95.4%
(FPCore (x s) :precision binary32 (/ (exp (- (/ (fabs x) s))) (* s 4.0)))
float code(float x, float s) {
return expf(-(fabsf(x) / s)) / (s * 4.0f);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = exp(-(abs(x) / s)) / (s * 4.0e0)
end function
function code(x, s) return Float32(exp(Float32(-Float32(abs(x) / s))) / Float32(s * Float32(4.0))) end
function tmp = code(x, s) tmp = exp(-(abs(x) / s)) / (s * single(4.0)); end
\begin{array}{l}
\\
\frac{e^{-\frac{\left|x\right|}{s}}}{s \cdot 4}
\end{array}
Initial program 98.9%
Taylor expanded in s around inf
*-commutativeN/A
lower-*.f3295.4
Simplified95.4%
Final simplification95.4%
(FPCore (x s) :precision binary32 (if (<= (fabs x) 1.9999999996399175e-23) (/ (/ 1.0 s) (fma (/ (/ (fabs x) s) s) (/ 1.0 (/ 1.0 (fabs x))) 4.0)) (/ 1.0 (* s (fma (/ 1.0 (* s s)) (* x x) 4.0)))))
float code(float x, float s) {
float tmp;
if (fabsf(x) <= 1.9999999996399175e-23f) {
tmp = (1.0f / s) / fmaf(((fabsf(x) / s) / s), (1.0f / (1.0f / fabsf(x))), 4.0f);
} else {
tmp = 1.0f / (s * fmaf((1.0f / (s * s)), (x * x), 4.0f));
}
return tmp;
}
function code(x, s) tmp = Float32(0.0) if (abs(x) <= Float32(1.9999999996399175e-23)) tmp = Float32(Float32(Float32(1.0) / s) / fma(Float32(Float32(abs(x) / s) / s), Float32(Float32(1.0) / Float32(Float32(1.0) / abs(x))), Float32(4.0))); else tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(Float32(1.0) / Float32(s * s)), Float32(x * x), Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.9999999996399175 \cdot 10^{-23}:\\
\;\;\;\;\frac{\frac{1}{s}}{\mathsf{fma}\left(\frac{\frac{\left|x\right|}{s}}{s}, \frac{1}{\frac{1}{\left|x\right|}}, 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{1}{s \cdot s}, x \cdot x, 4\right)}\\
\end{array}
\end{array}
if (fabs.f32 x) < 2e-23Initial program 97.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr97.2%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3261.9
Simplified61.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-+.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3261.9
lift-+.f32N/A
+-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
lower-/.f3275.1
Applied egg-rr75.1%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
associate-*r/N/A
sqr-absN/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-*.f32N/A
frac-timesN/A
lift-/.f32N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
lower-fma.f32N/A
lower-/.f32N/A
lower-/.f32N/A
lower-/.f3292.9
Applied egg-rr92.9%
if 2e-23 < (fabs.f32 x) Initial program 99.3%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.4%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.1
Simplified81.1%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-fma.f32N/A
lower-/.f3285.9
Applied egg-rr85.9%
(FPCore (x s) :precision binary32 (if (<= (fabs x) 1.9999999996399175e-23) (/ (/ 1.0 s) (fma x (/ 1.0 (* s (/ s x))) 4.0)) (/ 1.0 (* s (fma (/ 1.0 (* s s)) (* x x) 4.0)))))
float code(float x, float s) {
float tmp;
if (fabsf(x) <= 1.9999999996399175e-23f) {
tmp = (1.0f / s) / fmaf(x, (1.0f / (s * (s / x))), 4.0f);
} else {
tmp = 1.0f / (s * fmaf((1.0f / (s * s)), (x * x), 4.0f));
}
return tmp;
}
function code(x, s) tmp = Float32(0.0) if (abs(x) <= Float32(1.9999999996399175e-23)) tmp = Float32(Float32(Float32(1.0) / s) / fma(x, Float32(Float32(1.0) / Float32(s * Float32(s / x))), Float32(4.0))); else tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(Float32(1.0) / Float32(s * s)), Float32(x * x), Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.9999999996399175 \cdot 10^{-23}:\\
\;\;\;\;\frac{\frac{1}{s}}{\mathsf{fma}\left(x, \frac{1}{s \cdot \frac{s}{x}}, 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{1}{s \cdot s}, x \cdot x, 4\right)}\\
\end{array}
\end{array}
if (fabs.f32 x) < 2e-23Initial program 97.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr97.2%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3261.9
Simplified61.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-+.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3261.9
lift-+.f32N/A
+-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
lower-/.f3275.1
Applied egg-rr75.1%
associate-/r*N/A
clear-numN/A
lower-/.f32N/A
/-rgt-identityN/A
div-invN/A
metadata-evalN/A
div-invN/A
lift-/.f32N/A
times-fracN/A
lift-/.f32N/A
clear-numN/A
/-rgt-identityN/A
lower-*.f32N/A
lower-/.f3292.9
Applied egg-rr92.9%
if 2e-23 < (fabs.f32 x) Initial program 99.3%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.4%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.1
Simplified81.1%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-fma.f32N/A
lower-/.f3285.9
Applied egg-rr85.9%
Final simplification87.1%
(FPCore (x s) :precision binary32 (if (<= (fabs x) 1.9999999996399175e-23) (/ 1.0 (* s (+ 4.0 (/ (fabs x) (* s (/ s (fabs x))))))) (/ 1.0 (* s (fma (/ 1.0 (* s s)) (* x x) 4.0)))))
float code(float x, float s) {
float tmp;
if (fabsf(x) <= 1.9999999996399175e-23f) {
tmp = 1.0f / (s * (4.0f + (fabsf(x) / (s * (s / fabsf(x))))));
} else {
tmp = 1.0f / (s * fmaf((1.0f / (s * s)), (x * x), 4.0f));
}
return tmp;
}
function code(x, s) tmp = Float32(0.0) if (abs(x) <= Float32(1.9999999996399175e-23)) tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(4.0) + Float32(abs(x) / Float32(s * Float32(s / abs(x))))))); else tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(Float32(1.0) / Float32(s * s)), Float32(x * x), Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.9999999996399175 \cdot 10^{-23}:\\
\;\;\;\;\frac{1}{s \cdot \left(4 + \frac{\left|x\right|}{s \cdot \frac{s}{\left|x\right|}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{1}{s \cdot s}, x \cdot x, 4\right)}\\
\end{array}
\end{array}
if (fabs.f32 x) < 2e-23Initial program 97.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr97.2%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3261.9
Simplified61.9%
sqr-absN/A
lift-fabs.f32N/A
lift-fabs.f32N/A
frac-timesN/A
clear-numN/A
frac-timesN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
remove-double-negN/A
lower-/.f32N/A
lower-*.f32N/A
lower-/.f3283.8
Applied egg-rr83.8%
if 2e-23 < (fabs.f32 x) Initial program 99.3%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.4%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.1
Simplified81.1%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-fma.f32N/A
lower-/.f3285.9
Applied egg-rr85.9%
Final simplification85.6%
(FPCore (x s) :precision binary32 (if (<= (fabs x) 1.9999999996399175e-23) (/ 1.0 (* s (fma (/ x s) (/ x s) 4.0))) (/ 1.0 (* s (fma (/ 1.0 (* s s)) (* x x) 4.0)))))
float code(float x, float s) {
float tmp;
if (fabsf(x) <= 1.9999999996399175e-23f) {
tmp = 1.0f / (s * fmaf((x / s), (x / s), 4.0f));
} else {
tmp = 1.0f / (s * fmaf((1.0f / (s * s)), (x * x), 4.0f));
}
return tmp;
}
function code(x, s) tmp = Float32(0.0) if (abs(x) <= Float32(1.9999999996399175e-23)) tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(x / s), Float32(x / s), Float32(4.0)))); else tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(Float32(1.0) / Float32(s * s)), Float32(x * x), Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.9999999996399175 \cdot 10^{-23}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{1}{s \cdot s}, x \cdot x, 4\right)}\\
\end{array}
\end{array}
if (fabs.f32 x) < 2e-23Initial program 97.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr97.2%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3261.9
Simplified61.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
lower-fma.f32N/A
lower-/.f32N/A
lower-/.f3281.6
Applied egg-rr81.6%
if 2e-23 < (fabs.f32 x) Initial program 99.3%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.4%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.1
Simplified81.1%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-fma.f32N/A
lower-/.f3285.9
Applied egg-rr85.9%
(FPCore (x s) :precision binary32 (if (<= (fabs x) 1.9999999996399175e-23) (/ 1.0 (fma x (/ x s) (* s 4.0))) (/ 1.0 (* s (fma (/ 1.0 (* s s)) (* x x) 4.0)))))
float code(float x, float s) {
float tmp;
if (fabsf(x) <= 1.9999999996399175e-23f) {
tmp = 1.0f / fmaf(x, (x / s), (s * 4.0f));
} else {
tmp = 1.0f / (s * fmaf((1.0f / (s * s)), (x * x), 4.0f));
}
return tmp;
}
function code(x, s) tmp = Float32(0.0) if (abs(x) <= Float32(1.9999999996399175e-23)) tmp = Float32(Float32(1.0) / fma(x, Float32(x / s), Float32(s * Float32(4.0)))); else tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(Float32(1.0) / Float32(s * s)), Float32(x * x), Float32(4.0)))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.9999999996399175 \cdot 10^{-23}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(x, \frac{x}{s}, s \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{1}{s \cdot s}, x \cdot x, 4\right)}\\
\end{array}
\end{array}
if (fabs.f32 x) < 2e-23Initial program 97.1%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr97.2%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3261.9
Simplified61.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
Applied egg-rr81.6%
if 2e-23 < (fabs.f32 x) Initial program 99.3%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.4%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.1
Simplified81.1%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-fma.f32N/A
lower-/.f3285.9
Applied egg-rr85.9%
(FPCore (x s) :precision binary32 (/ 1.0 (* s (fma x (/ x (* s s)) 4.0))))
float code(float x, float s) {
return 1.0f / (s * fmaf(x, (x / (s * s)), 4.0f));
}
function code(x, s) return Float32(Float32(1.0) / Float32(s * fma(x, Float32(x / Float32(s * s)), Float32(4.0)))) end
\begin{array}{l}
\\
\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-+.f32N/A
*-commutativeN/A
lower-*.f3277.9
lift-+.f32N/A
+-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
lower-/.f3280.5
Applied egg-rr80.5%
Final simplification80.5%
(FPCore (x s) :precision binary32 (/ 1.0 (fma x (/ x s) (* s 4.0))))
float code(float x, float s) {
return 1.0f / fmaf(x, (x / s), (s * 4.0f));
}
function code(x, s) return Float32(Float32(1.0) / fma(x, Float32(x / s), Float32(s * Float32(4.0)))) end
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(x, \frac{x}{s}, s \cdot 4\right)}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lift-*.f32N/A
associate-/l*N/A
lower-fma.f32N/A
Applied egg-rr66.6%
(FPCore (x s) :precision binary32 (/ 1.0 (fma s 4.0 (/ (* x x) s))))
float code(float x, float s) {
return 1.0f / fmaf(s, 4.0f, ((x * x) / s));
}
function code(x, s) return Float32(Float32(1.0) / fma(s, Float32(4.0), Float32(Float32(x * x) / s))) end
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(s, 4, \frac{x \cdot x}{s}\right)}
\end{array}
Initial program 98.9%
lift-fabs.f32N/A
remove-double-negN/A
lift-neg.f32N/A
remove-double-negN/A
frac-2negN/A
frac-2negN/A
lift-/.f32N/A
lift-exp.f32N/A
Applied egg-rr99.0%
Taylor expanded in s around inf
lower-*.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
sqr-absN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3277.9
Simplified77.9%
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lift-*.f32N/A
pow2N/A
pow-flipN/A
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
inv-powN/A
div-invN/A
lower-fma.f32N/A
lower-/.f3266.2
Applied egg-rr66.2%
(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.9%
Taylor expanded in s around inf
lower-/.f3224.6
Simplified24.6%
herbie shell --seed 2024208
(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))))))