
(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 (/ 1.0 (+ 1.0 (pow (exp (* (/ x s) -0.5)) 2.0))))
float code(float x, float s) {
return 1.0f / (1.0f + powf(expf(((x / s) * -0.5f)), 2.0f));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (1.0e0 + (exp(((x / s) * (-0.5e0))) ** 2.0e0))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + (exp(Float32(Float32(x / s) * Float32(-0.5))) ^ Float32(2.0)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + (exp(((x / s) * single(-0.5))) ^ single(2.0))); end
\begin{array}{l}
\\
\frac{1}{1 + {\left(e^{\frac{x}{s} \cdot -0.5}\right)}^{2}}
\end{array}
Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
inv-powN/A
sqr-powN/A
pow2N/A
pow-lowering-pow.f32N/A
metadata-evalN/A
metadata-evalN/A
pow-expN/A
exp-lowering-exp.f32N/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
metadata-eval99.8%
Applied egg-rr99.8%
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (/ 1.0 (exp (/ x s))))))
float code(float x, float s) {
return 1.0f / (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 + (1.0e0 / exp((x / s))))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / exp(Float32(x / s))))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + (single(1.0) / exp((x / s)))); end
\begin{array}{l}
\\
\frac{1}{1 + \frac{1}{e^{\frac{x}{s}}}}
\end{array}
Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
(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 (- s)) 50.0)
(/
1.0
(+
1.0
(/
1.0
(+
1.0
(/
(+
x
(/ (+ (* 0.5 (* x x)) (/ (* x (* (* x x) 0.16666666666666666)) s)) s))
s)))))
(/
1.0
(+
2.0
(*
x
(+
(* x (+ (* -0.16666666666666666 (/ x (* s (* s s)))) (/ 0.5 (* s s))))
(/ -1.0 s)))))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 50.0f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + ((x + (((0.5f * (x * x)) + ((x * ((x * x) * 0.16666666666666666f)) / s)) / s)) / s))));
} else {
tmp = 1.0f / (2.0f + (x * ((x * ((-0.16666666666666666f * (x / (s * (s * s)))) + (0.5f / (s * s)))) + (-1.0f / s))));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((x / -s) <= 50.0e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + ((x + (((0.5e0 * (x * x)) + ((x * ((x * x) * 0.16666666666666666e0)) / s)) / s)) / s))))
else
tmp = 1.0e0 / (2.0e0 + (x * ((x * (((-0.16666666666666666e0) * (x / (s * (s * s)))) + (0.5e0 / (s * s)))) + ((-1.0e0) / s))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(50.0)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(x + Float32(Float32(Float32(Float32(0.5) * Float32(x * x)) + Float32(Float32(x * Float32(Float32(x * x) * Float32(0.16666666666666666))) / s)) / s)) / s))))); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(x * Float32(Float32(Float32(-0.16666666666666666) * Float32(x / Float32(s * Float32(s * s)))) + Float32(Float32(0.5) / Float32(s * s)))) + Float32(Float32(-1.0) / s))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(50.0)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + ((x + (((single(0.5) * (x * x)) + ((x * ((x * x) * single(0.16666666666666666))) / s)) / s)) / s)))); else tmp = single(1.0) / (single(2.0) + (x * ((x * ((single(-0.16666666666666666) * (x / (s * (s * s)))) + (single(0.5) / (s * s)))) + (single(-1.0) / s)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 50:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x + \frac{0.5 \cdot \left(x \cdot x\right) + \frac{x \cdot \left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)}{s}}{s}}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + x \cdot \left(x \cdot \left(-0.16666666666666666 \cdot \frac{x}{s \cdot \left(s \cdot s\right)} + \frac{0.5}{s \cdot s}\right) + \frac{-1}{s}\right)}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 50Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified94.6%
if 50 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0
Simplified96.2%
Final simplification95.2%
(FPCore (x s)
:precision binary32
(if (<= (/ x (- s)) 50.0)
(/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ (- x (* (* x x) (/ -0.5 s))) s)))))
(/
1.0
(+
2.0
(*
x
(+
(* x (+ (* -0.16666666666666666 (/ x (* s (* s s)))) (/ 0.5 (* s s))))
(/ -1.0 s)))))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 50.0f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + ((x - ((x * x) * (-0.5f / s))) / s))));
} else {
tmp = 1.0f / (2.0f + (x * ((x * ((-0.16666666666666666f * (x / (s * (s * s)))) + (0.5f / (s * s)))) + (-1.0f / s))));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((x / -s) <= 50.0e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + ((x - ((x * x) * ((-0.5e0) / s))) / s))))
else
tmp = 1.0e0 / (2.0e0 + (x * ((x * (((-0.16666666666666666e0) * (x / (s * (s * s)))) + (0.5e0 / (s * s)))) + ((-1.0e0) / s))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(50.0)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(x - Float32(Float32(x * x) * Float32(Float32(-0.5) / s))) / s))))); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(x * Float32(Float32(Float32(-0.16666666666666666) * Float32(x / Float32(s * Float32(s * s)))) + Float32(Float32(0.5) / Float32(s * s)))) + Float32(Float32(-1.0) / s))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(50.0)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + ((x - ((x * x) * (single(-0.5) / s))) / s)))); else tmp = single(1.0) / (single(2.0) + (x * ((x * ((single(-0.16666666666666666) * (x / (s * (s * s)))) + (single(0.5) / (s * s)))) + (single(-1.0) / s)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 50:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x - \left(x \cdot x\right) \cdot \frac{-0.5}{s}}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + x \cdot \left(x \cdot \left(-0.16666666666666666 \cdot \frac{x}{s \cdot \left(s \cdot s\right)} + \frac{0.5}{s \cdot s}\right) + \frac{-1}{s}\right)}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 50Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified93.8%
if 50 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0
Simplified96.2%
Final simplification94.7%
(FPCore (x s)
:precision binary32
(if (<= (/ x (- s)) 0.4000000059604645)
(/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ (- x (* (* x x) (/ -0.5 s))) s)))))
(/
1.0
(+
2.0
(*
x
(+
(/ -1.0 s)
(* x (/ (+ 0.5 (/ (* x -0.16666666666666666) s)) (* s s)))))))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 0.4000000059604645f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + ((x - ((x * x) * (-0.5f / s))) / s))));
} else {
tmp = 1.0f / (2.0f + (x * ((-1.0f / s) + (x * ((0.5f + ((x * -0.16666666666666666f) / s)) / (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 / -s) <= 0.4000000059604645e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + ((x - ((x * x) * ((-0.5e0) / s))) / s))))
else
tmp = 1.0e0 / (2.0e0 + (x * (((-1.0e0) / s) + (x * ((0.5e0 + ((x * (-0.16666666666666666e0)) / s)) / (s * s))))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(0.4000000059604645)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(x - Float32(Float32(x * x) * Float32(Float32(-0.5) / s))) / s))))); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(Float32(-1.0) / s) + Float32(x * Float32(Float32(Float32(0.5) + Float32(Float32(x * Float32(-0.16666666666666666)) / s)) / Float32(s * s))))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(0.4000000059604645)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + ((x - ((x * x) * (single(-0.5) / s))) / s)))); else tmp = single(1.0) / (single(2.0) + (x * ((single(-1.0) / s) + (x * ((single(0.5) + ((x * single(-0.16666666666666666)) / s)) / (s * s)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 0.4000000059604645:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x - \left(x \cdot x\right) \cdot \frac{-0.5}{s}}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + x \cdot \left(\frac{-1}{s} + x \cdot \frac{0.5 + \frac{x \cdot -0.16666666666666666}{s}}{s \cdot s}\right)}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 0.400000006Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.1%
if 0.400000006 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
Simplified92.6%
Taylor expanded in s around inf
/-lowering-/.f32N/A
+-lowering-+.f32N/A
associate-*r/N/A
/-lowering-/.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3292.0%
Simplified92.0%
Final simplification94.5%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) 50.0) (/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ (- x (* (* x x) (/ -0.5 s))) s))))) (/ (/ (* -6.0 (/ (* s (* s s)) x)) x) x)))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 50.0f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + ((x - ((x * x) * (-0.5f / s))) / s))));
} else {
tmp = ((-6.0f * ((s * (s * s)) / 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 / -s) <= 50.0e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + ((x - ((x * x) * ((-0.5e0) / s))) / s))))
else
tmp = (((-6.0e0) * ((s * (s * s)) / x)) / x) / x
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(50.0)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(x - Float32(Float32(x * x) * Float32(Float32(-0.5) / s))) / s))))); else tmp = Float32(Float32(Float32(Float32(-6.0) * Float32(Float32(s * Float32(s * s)) / x)) / x) / x); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(50.0)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + ((x - ((x * x) * (single(-0.5) / s))) / s)))); else tmp = ((single(-6.0) * ((s * (s * s)) / x)) / x) / x; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 50:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x - \left(x \cdot x\right) \cdot \frac{-0.5}{s}}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-6 \cdot \frac{s \cdot \left(s \cdot s\right)}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 50Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified93.8%
if 50 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0
Simplified96.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
cube-multN/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f32N/A
cube-multN/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3277.5%
Simplified77.5%
associate-/r*N/A
associate-/r*N/A
/-lowering-/.f32N/A
/-lowering-/.f32N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
*-lowering-*.f32N/A
*-lowering-*.f3295.4%
Applied egg-rr95.4%
Final simplification94.4%
(FPCore (x s)
:precision binary32
(let* ((t_0 (/ x (- s))))
(if (<= t_0 -5.0)
1.0
(if (<= t_0 0.5)
(- 0.5 (* (/ x s) -0.25))
(/ (* -2.0 (/ (* s s) x)) x)))))
float code(float x, float s) {
float t_0 = x / -s;
float tmp;
if (t_0 <= -5.0f) {
tmp = 1.0f;
} else if (t_0 <= 0.5f) {
tmp = 0.5f - ((x / s) * -0.25f);
} else {
tmp = (-2.0f * ((s * s) / x)) / x;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: tmp
t_0 = x / -s
if (t_0 <= (-5.0e0)) then
tmp = 1.0e0
else if (t_0 <= 0.5e0) then
tmp = 0.5e0 - ((x / s) * (-0.25e0))
else
tmp = ((-2.0e0) * ((s * s) / x)) / x
end if
code = tmp
end function
function code(x, s) t_0 = Float32(x / Float32(-s)) tmp = Float32(0.0) if (t_0 <= Float32(-5.0)) tmp = Float32(1.0); elseif (t_0 <= Float32(0.5)) tmp = Float32(Float32(0.5) - Float32(Float32(x / s) * Float32(-0.25))); else tmp = Float32(Float32(Float32(-2.0) * Float32(Float32(s * s) / x)) / x); end return tmp end
function tmp_2 = code(x, s) t_0 = x / -s; tmp = single(0.0); if (t_0 <= single(-5.0)) tmp = single(1.0); elseif (t_0 <= single(0.5)) tmp = single(0.5) - ((x / s) * single(-0.25)); else tmp = (single(-2.0) * ((s * s) / x)) / x; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{-s}\\
\mathbf{if}\;t\_0 \leq -5:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;0.5 - \frac{x}{s} \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{s \cdot s}{x}}{x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) < 0.5Initial program 99.6%
Taylor expanded in x around 0
metadata-evalN/A
cancel-sign-sub-invN/A
--lowering--.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
/-lowering-/.f3296.6%
Simplified96.6%
if 0.5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3239.6%
Simplified39.6%
Taylor expanded in x around inf
+-commutativeN/A
metadata-evalN/A
cancel-sign-sub-invN/A
/-lowering-/.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f32N/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3236.3%
Simplified36.3%
Taylor expanded in s around inf
*-lowering-*.f32N/A
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f3284.5%
Simplified84.5%
Final simplification92.9%
(FPCore (x s)
:precision binary32
(let* ((t_0 (/ x (- s))))
(if (<= t_0 -5.0)
1.0
(if (<= t_0 0.5) (- 0.5 (* (/ x s) -0.25)) (/ -1.0 (/ x s))))))
float code(float x, float s) {
float t_0 = x / -s;
float tmp;
if (t_0 <= -5.0f) {
tmp = 1.0f;
} else if (t_0 <= 0.5f) {
tmp = 0.5f - ((x / s) * -0.25f);
} else {
tmp = -1.0f / (x / 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) :: tmp
t_0 = x / -s
if (t_0 <= (-5.0e0)) then
tmp = 1.0e0
else if (t_0 <= 0.5e0) then
tmp = 0.5e0 - ((x / s) * (-0.25e0))
else
tmp = (-1.0e0) / (x / s)
end if
code = tmp
end function
function code(x, s) t_0 = Float32(x / Float32(-s)) tmp = Float32(0.0) if (t_0 <= Float32(-5.0)) tmp = Float32(1.0); elseif (t_0 <= Float32(0.5)) tmp = Float32(Float32(0.5) - Float32(Float32(x / s) * Float32(-0.25))); else tmp = Float32(Float32(-1.0) / Float32(x / s)); end return tmp end
function tmp_2 = code(x, s) t_0 = x / -s; tmp = single(0.0); if (t_0 <= single(-5.0)) tmp = single(1.0); elseif (t_0 <= single(0.5)) tmp = single(0.5) - ((x / s) * single(-0.25)); else tmp = single(-1.0) / (x / s); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{-s}\\
\mathbf{if}\;t\_0 \leq -5:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;0.5 - \frac{x}{s} \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{x}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) < 0.5Initial program 99.6%
Taylor expanded in x around 0
metadata-evalN/A
cancel-sign-sub-invN/A
--lowering--.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
/-lowering-/.f3296.6%
Simplified96.6%
if 0.5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3239.6%
Simplified39.6%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f32N/A
/-lowering-/.f3236.3%
Simplified36.3%
sub0-negN/A
clear-numN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f32N/A
/-lowering-/.f3239.6%
Applied egg-rr39.6%
Final simplification75.4%
(FPCore (x s) :precision binary32 (let* ((t_0 (/ x (- s)))) (if (<= t_0 -5.0) 1.0 (if (<= t_0 0.5) 0.5 (/ -1.0 (/ x s))))))
float code(float x, float s) {
float t_0 = x / -s;
float tmp;
if (t_0 <= -5.0f) {
tmp = 1.0f;
} else if (t_0 <= 0.5f) {
tmp = 0.5f;
} else {
tmp = -1.0f / (x / 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) :: tmp
t_0 = x / -s
if (t_0 <= (-5.0e0)) then
tmp = 1.0e0
else if (t_0 <= 0.5e0) then
tmp = 0.5e0
else
tmp = (-1.0e0) / (x / s)
end if
code = tmp
end function
function code(x, s) t_0 = Float32(x / Float32(-s)) tmp = Float32(0.0) if (t_0 <= Float32(-5.0)) tmp = Float32(1.0); elseif (t_0 <= Float32(0.5)) tmp = Float32(0.5); else tmp = Float32(Float32(-1.0) / Float32(x / s)); end return tmp end
function tmp_2 = code(x, s) t_0 = x / -s; tmp = single(0.0); if (t_0 <= single(-5.0)) tmp = single(1.0); elseif (t_0 <= single(0.5)) tmp = single(0.5); else tmp = single(-1.0) / (x / s); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{-s}\\
\mathbf{if}\;t\_0 \leq -5:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{x}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) < 0.5Initial program 99.6%
Taylor expanded in x around 0
Simplified87.2%
if 0.5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3239.6%
Simplified39.6%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f32N/A
/-lowering-/.f3236.3%
Simplified36.3%
sub0-negN/A
clear-numN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f32N/A
/-lowering-/.f3239.6%
Applied egg-rr39.6%
Final simplification73.1%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) 50.0) (/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ x s))))) (/ (/ (* -6.0 (/ (* s (* s s)) x)) x) x)))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 50.0f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + (x / s))));
} else {
tmp = ((-6.0f * ((s * (s * s)) / 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 / -s) <= 50.0e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + (x / s))))
else
tmp = (((-6.0e0) * ((s * (s * s)) / x)) / x) / x
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(50.0)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))))); else tmp = Float32(Float32(Float32(Float32(-6.0) * Float32(Float32(s * Float32(s * s)) / x)) / x) / x); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(50.0)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + (x / s)))); else tmp = ((single(-6.0) * ((s * (s * s)) / x)) / x) / x; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 50:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-6 \cdot \frac{s \cdot \left(s \cdot s\right)}{x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 50Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f32N/A
/-lowering-/.f3292.4%
Simplified92.4%
if 50 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0
Simplified96.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f32N/A
*-commutativeN/A
*-lowering-*.f32N/A
cube-multN/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f32N/A
cube-multN/A
unpow2N/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3277.5%
Simplified77.5%
associate-/r*N/A
associate-/r*N/A
/-lowering-/.f32N/A
/-lowering-/.f32N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f32N/A
/-lowering-/.f32N/A
*-lowering-*.f32N/A
*-lowering-*.f3295.4%
Applied egg-rr95.4%
Final simplification93.5%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) 50.0) (/ 1.0 (+ 1.0 (/ 1.0 (+ 1.0 (/ x s))))) (/ (* -2.0 (/ (* s s) x)) x)))
float code(float x, float s) {
float tmp;
if ((x / -s) <= 50.0f) {
tmp = 1.0f / (1.0f + (1.0f / (1.0f + (x / s))));
} else {
tmp = (-2.0f * ((s * 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 / -s) <= 50.0e0) then
tmp = 1.0e0 / (1.0e0 + (1.0e0 / (1.0e0 + (x / s))))
else
tmp = ((-2.0e0) * ((s * s) / x)) / x
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(50.0)) tmp = Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(Float32(1.0) / Float32(Float32(1.0) + Float32(x / s))))); else tmp = Float32(Float32(Float32(-2.0) * Float32(Float32(s * s) / x)) / x); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(50.0)) tmp = single(1.0) / (single(1.0) + (single(1.0) / (single(1.0) + (x / s)))); else tmp = (single(-2.0) * ((s * s) / x)) / x; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq 50:\\
\;\;\;\;\frac{1}{1 + \frac{1}{1 + \frac{x}{s}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{s \cdot s}{x}}{x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 50Initial program 99.8%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f3299.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f32N/A
/-lowering-/.f3292.4%
Simplified92.4%
if 50 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3240.4%
Simplified40.4%
Taylor expanded in x around inf
+-commutativeN/A
metadata-evalN/A
cancel-sign-sub-invN/A
/-lowering-/.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f32N/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f32N/A
unpow2N/A
*-lowering-*.f3237.0%
Simplified37.0%
Taylor expanded in s around inf
*-lowering-*.f32N/A
/-lowering-/.f32N/A
unpow2N/A
*-lowering-*.f3287.8%
Simplified87.8%
Final simplification90.7%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) -5.0) 1.0 (/ 1.0 (/ (- (* s 2.0) x) s))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= -5.0f) {
tmp = 1.0f;
} else {
tmp = 1.0f / (((s * 2.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 / -s) <= (-5.0e0)) then
tmp = 1.0e0
else
tmp = 1.0e0 / (((s * 2.0e0) - x) / s)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(-5.0)) tmp = Float32(1.0); else tmp = Float32(Float32(1.0) / Float32(Float32(Float32(s * Float32(2.0)) - x) / s)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(-5.0)) tmp = single(1.0); else tmp = single(1.0) / (((s * single(2.0)) - x) / s); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq -5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{s \cdot 2 - x}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3260.4%
Simplified60.4%
Taylor expanded in s around 0
sub-negN/A
mul-1-negN/A
+-commutativeN/A
/-lowering-/.f32N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f32N/A
*-commutativeN/A
*-lowering-*.f3260.4%
Simplified60.4%
Final simplification74.7%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) -5.0) 1.0 (/ 1.0 (+ 2.0 (/ -1.0 (/ s x))))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= -5.0f) {
tmp = 1.0f;
} else {
tmp = 1.0f / (2.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 / -s) <= (-5.0e0)) then
tmp = 1.0e0
else
tmp = 1.0e0 / (2.0e0 + ((-1.0e0) / (s / x)))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(-5.0)) tmp = Float32(1.0); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(Float32(-1.0) / Float32(s / x)))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(-5.0)) tmp = single(1.0); else tmp = single(1.0) / (single(2.0) + (single(-1.0) / (s / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq -5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \frac{-1}{\frac{s}{x}}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3260.4%
Simplified60.4%
clear-numN/A
/-lowering-/.f32N/A
/-lowering-/.f3260.4%
Applied egg-rr60.4%
Final simplification74.7%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) -5.0) 1.0 (/ 1.0 (+ 2.0 (* x (/ -1.0 s))))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= -5.0f) {
tmp = 1.0f;
} else {
tmp = 1.0f / (2.0f + (x * (-1.0f / s)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((x / -s) <= (-5.0e0)) then
tmp = 1.0e0
else
tmp = 1.0e0 / (2.0e0 + (x * ((-1.0e0) / s)))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(-5.0)) tmp = Float32(1.0); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(x * Float32(Float32(-1.0) / s)))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(-5.0)) tmp = single(1.0); else tmp = single(1.0) / (single(2.0) + (x * (single(-1.0) / s))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq -5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + x \cdot \frac{-1}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3260.4%
Simplified60.4%
clear-numN/A
associate-/r/N/A
*-lowering-*.f32N/A
/-lowering-/.f3260.4%
Applied egg-rr60.4%
Final simplification74.7%
(FPCore (x s) :precision binary32 (if (<= (/ x (- s)) -5.0) 1.0 (/ 1.0 (- 2.0 (/ x s)))))
float code(float x, float s) {
float tmp;
if ((x / -s) <= -5.0f) {
tmp = 1.0f;
} else {
tmp = 1.0f / (2.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 / -s) <= (-5.0e0)) then
tmp = 1.0e0
else
tmp = 1.0e0 / (2.0e0 - (x / s))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(x / Float32(-s)) <= Float32(-5.0)) tmp = Float32(1.0); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) - Float32(x / s))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((x / -s) <= single(-5.0)) tmp = single(1.0); else tmp = single(1.0) / (single(2.0) - (x / s)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{-s} \leq -5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 - \frac{x}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified96.3%
Taylor expanded in x around inf
Simplified99.5%
if -5 < (/.f32 (neg.f32 x) s) Initial program 99.7%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3260.4%
Simplified60.4%
Final simplification74.7%
(FPCore (x s) :precision binary32 (if (<= x -4.999999873689376e-5) (- 0.0 (/ s x)) (if (<= x 1.999999936531045e-20) 0.5 1.0)))
float code(float x, float s) {
float tmp;
if (x <= -4.999999873689376e-5f) {
tmp = 0.0f - (s / x);
} else if (x <= 1.999999936531045e-20f) {
tmp = 0.5f;
} else {
tmp = 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 <= (-4.999999873689376e-5)) then
tmp = 0.0e0 - (s / x)
else if (x <= 1.999999936531045e-20) then
tmp = 0.5e0
else
tmp = 1.0e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-4.999999873689376e-5)) tmp = Float32(Float32(0.0) - Float32(s / x)); elseif (x <= Float32(1.999999936531045e-20)) tmp = Float32(0.5); else tmp = Float32(1.0); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-4.999999873689376e-5)) tmp = single(0.0) - (s / x); elseif (x <= single(1.999999936531045e-20)) tmp = single(0.5); else tmp = single(1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;0 - \frac{s}{x}\\
\mathbf{elif}\;x \leq 1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.99999987e-5Initial program 100.0%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f3253.3%
Simplified53.3%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f32N/A
/-lowering-/.f3248.5%
Simplified48.5%
sub0-negN/A
distribute-neg-fracN/A
/-lowering-/.f32N/A
neg-lowering-neg.f3248.5%
Applied egg-rr48.5%
if -4.99999987e-5 < x < 1.99999994e-20Initial program 99.4%
Taylor expanded in x around 0
Simplified58.0%
if 1.99999994e-20 < x Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified97.1%
Taylor expanded in x around inf
Simplified94.0%
Final simplification68.9%
(FPCore (x s) :precision binary32 (if (<= x 1.999999936531045e-20) 0.5 1.0))
float code(float x, float s) {
float tmp;
if (x <= 1.999999936531045e-20f) {
tmp = 0.5f;
} else {
tmp = 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 <= 1.999999936531045e-20) then
tmp = 0.5e0
else
tmp = 1.0e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(1.999999936531045e-20)) tmp = Float32(0.5); else tmp = Float32(1.0); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(1.999999936531045e-20)) tmp = single(0.5); else tmp = single(1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 1.99999994e-20Initial program 99.6%
Taylor expanded in x around 0
Simplified35.8%
if 1.99999994e-20 < x Initial program 100.0%
distribute-frac-negN/A
exp-negN/A
/-lowering-/.f32N/A
exp-lowering-exp.f32N/A
/-lowering-/.f32100.0%
Applied egg-rr100.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
--lowering--.f32N/A
/-lowering-/.f32N/A
Simplified97.1%
Taylor expanded in x around inf
Simplified94.0%
(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
Simplified34.1%
herbie shell --seed 2024158
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))