
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = -log((1.0e0 - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = -log((single(1.0) - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = -log((1.0e0 - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = -log((single(1.0) - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (pow (/ (* alphax alphax) cos2phi) -0.5)))
(if (<= (- 1.0 u0) 0.9965000152587891)
(/ (log (- 1.0 u0)) (- (/ sin2phi (- (* alphay alphay))) (* t_0 t_0)))
(/
(- u0 (* u0 (* u0 -0.5)))
(+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = powf(((alphax * alphax) / cos2phi), -0.5f);
float tmp;
if ((1.0f - u0) <= 0.9965000152587891f) {
tmp = logf((1.0f - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0));
} else {
tmp = (u0 - (u0 * (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = ((alphax * alphax) / cos2phi) ** (-0.5e0)
if ((1.0e0 - u0) <= 0.9965000152587891e0) then
tmp = log((1.0e0 - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0))
else
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(Float32(alphax * alphax) / cos2phi) ^ Float32(-0.5) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891)) tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(sin2phi / Float32(-Float32(alphay * alphay))) - Float32(t_0 * t_0))); else tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = ((alphax * alphax) / cos2phi) ^ single(-0.5); tmp = single(0.0); if ((single(1.0) - u0) <= single(0.9965000152587891)) tmp = log((single(1.0) - u0)) / ((sin2phi / -(alphay * alphay)) - (t_0 * t_0)); else tmp = (u0 - (u0 * (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{alphax \cdot alphax}{cos2phi}\right)}^{-0.5}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{sin2phi}{-alphay \cdot alphay} - t\_0 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.99650002Initial program 93.4%
lift-*.f32N/A
clear-numN/A
inv-powN/A
sqr-powN/A
lower-*.f32N/A
lower-pow.f32N/A
lower-/.f32N/A
metadata-evalN/A
lower-pow.f32N/A
lower-/.f32N/A
metadata-eval93.5
Applied rewrites93.5%
if 0.99650002 < (-.f32 #s(literal 1 binary32) u0) Initial program 49.9%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3217.6
Applied rewrites17.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3298.1
Applied rewrites98.1%
Final simplification96.9%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= (- (log (- 1.0 u0))) 0.027000000700354576)
(/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax))))
(/ (log (/ 1.0 (- 1.0 u0))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if (-logf((1.0f - u0)) <= 0.027000000700354576f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
} else {
tmp = logf((1.0f / (1.0f - u0))) / t_0;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = sin2phi / (alphay * alphay)
if (-log((1.0e0 - u0)) <= 0.027000000700354576e0) then
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
else
tmp = log((1.0e0 / (1.0e0 - u0))) / t_0
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (Float32(-log(Float32(Float32(1.0) - u0))) <= Float32(0.027000000700354576)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(log(Float32(Float32(1.0) / Float32(Float32(1.0) - u0))) / t_0); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = sin2phi / (alphay * alphay); tmp = single(0.0); if (-log((single(1.0) - u0)) <= single(0.027000000700354576)) tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax))); else tmp = log((single(1.0) / (single(1.0) - u0))) / t_0; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;-\log \left(1 - u0\right) \leq 0.027000000700354576:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{1}{1 - u0}\right)}{t\_0}\\
\end{array}
\end{array}
if (neg.f32 (log.f32 (-.f32 #s(literal 1 binary32) u0))) < 0.0270000007Initial program 54.8%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3216.4
Applied rewrites16.3%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3295.0
Applied rewrites95.0%
if 0.0270000007 < (neg.f32 (log.f32 (-.f32 #s(literal 1 binary32) u0))) Initial program 96.3%
lift--.f32N/A
lift-log.f32N/A
remove-double-negN/A
lift-log.f32N/A
neg-logN/A
neg-logN/A
clear-numN/A
log-recN/A
clear-numN/A
lower-log.f32N/A
lower-/.f3295.2
Applied rewrites95.2%
Taylor expanded in cos2phi around 0
lower-/.f32N/A
unpow2N/A
lower-*.f3274.1
Applied rewrites74.1%
Final simplification91.8%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
(if (<= (- 1.0 u0) 0.9965000152587891)
(/ (log (- 1.0 u0)) (/ 1.0 (/ -1.0 t_0)))
(/ (- u0 (* u0 (* u0 -0.5))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax));
float tmp;
if ((1.0f - u0) <= 0.9965000152587891f) {
tmp = logf((1.0f - u0)) / (1.0f / (-1.0f / t_0));
} else {
tmp = (u0 - (u0 * (u0 * -0.5f))) / t_0;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))
if ((1.0e0 - u0) <= 0.9965000152587891e0) then
tmp = log((1.0e0 - u0)) / (1.0e0 / ((-1.0e0) / t_0))
else
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / t_0
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax))) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891)) tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(1.0) / Float32(Float32(-1.0) / t_0))); else tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / t_0); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = (sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)); tmp = single(0.0); if ((single(1.0) - u0) <= single(0.9965000152587891)) tmp = log((single(1.0) - u0)) / (single(1.0) / (single(-1.0) / t_0)); else tmp = (u0 - (u0 * (u0 * single(-0.5)))) / t_0; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{1}{\frac{-1}{t\_0}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.99650002Initial program 93.4%
lift--.f32N/A
lift-log.f32N/A
remove-double-negN/A
lift-log.f32N/A
neg-logN/A
neg-logN/A
clear-numN/A
log-recN/A
clear-numN/A
lower-log.f32N/A
lower-/.f3291.3
Applied rewrites91.3%
lift-*.f32N/A
lift-/.f32N/A
lift-*.f32N/A
lift-/.f32N/A
+-commutativeN/A
flip-+N/A
lower-/.f32N/A
Applied rewrites63.2%
Applied rewrites91.3%
lift--.f32N/A
/-rgt-identityN/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
log-recN/A
lower-neg.f32N/A
lower-log.f32N/A
lower-neg.f32N/A
lower-neg.f3293.4
Applied rewrites93.4%
if 0.99650002 < (-.f32 #s(literal 1 binary32) u0) Initial program 49.9%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3217.6
Applied rewrites17.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3298.1
Applied rewrites98.1%
Final simplification96.9%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= (- 1.0 u0) 0.9965000152587891)
(/ (log (- 1.0 u0)) (- (* cos2phi (/ -1.0 (* alphax alphax))) t_0))
(/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if ((1.0f - u0) <= 0.9965000152587891f) {
tmp = logf((1.0f - u0)) / ((cos2phi * (-1.0f / (alphax * alphax))) - t_0);
} else {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = sin2phi / (alphay * alphay)
if ((1.0e0 - u0) <= 0.9965000152587891e0) then
tmp = log((1.0e0 - u0)) / ((cos2phi * ((-1.0e0) / (alphax * alphax))) - t_0)
else
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891)) tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(cos2phi * Float32(Float32(-1.0) / Float32(alphax * alphax))) - t_0)); else tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax)))); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = sin2phi / (alphay * alphay); tmp = single(0.0); if ((single(1.0) - u0) <= single(0.9965000152587891)) tmp = log((single(1.0) - u0)) / ((cos2phi * (single(-1.0) / (alphax * alphax))) - t_0); else tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{cos2phi \cdot \frac{-1}{alphax \cdot alphax} - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.99650002Initial program 93.4%
lift-*.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3293.4
Applied rewrites93.4%
if 0.99650002 < (-.f32 #s(literal 1 binary32) u0) Initial program 49.9%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3217.6
Applied rewrites17.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3298.1
Applied rewrites98.1%
Final simplification96.9%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= (- 1.0 u0) 0.9965000152587891)
(/ (log (- 1.0 u0)) (- (/ cos2phi (* alphax (- alphax))) t_0))
(/ (- u0 (* u0 (* u0 -0.5))) (+ t_0 (/ cos2phi (* alphax alphax)))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if ((1.0f - u0) <= 0.9965000152587891f) {
tmp = logf((1.0f - u0)) / ((cos2phi / (alphax * -alphax)) - t_0);
} else {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (cos2phi / (alphax * alphax)));
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = sin2phi / (alphay * alphay)
if ((1.0e0 - u0) <= 0.9965000152587891e0) then
tmp = log((1.0e0 - u0)) / ((cos2phi / (alphax * -alphax)) - t_0)
else
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (t_0 + (cos2phi / (alphax * alphax)))
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.9965000152587891)) tmp = Float32(log(Float32(Float32(1.0) - u0)) / Float32(Float32(cos2phi / Float32(alphax * Float32(-alphax))) - t_0)); else tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax)))); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = sin2phi / (alphay * alphay); tmp = single(0.0); if ((single(1.0) - u0) <= single(0.9965000152587891)) tmp = log((single(1.0) - u0)) / ((cos2phi / (alphax * -alphax)) - t_0); else tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (t_0 + (cos2phi / (alphax * alphax))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;1 - u0 \leq 0.9965000152587891:\\
\;\;\;\;\frac{\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot \left(-alphax\right)} - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.99650002Initial program 93.4%
if 0.99650002 < (-.f32 #s(literal 1 binary32) u0) Initial program 49.9%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3217.6
Applied rewrites17.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3298.1
Applied rewrites98.1%
Final simplification96.9%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 0.800000011920929) (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))) (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 0.800000011920929f) {
tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
} else {
tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 0.800000011920929e0) then
tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
else
tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(0.800000011920929)) tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay))); else tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(0.800000011920929)) tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay)); else tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 0.800000011920929:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 0.800000012Initial program 54.7%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3275.8
Applied rewrites75.8%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3275.9
Applied rewrites75.9%
if 0.800000012 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 66.1%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3223.8
Applied rewrites23.7%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3287.4
Applied rewrites87.4%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3287.4
Applied rewrites87.4%
Taylor expanded in cos2phi around 0
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3286.6
Applied rewrites86.6%
Final simplification81.9%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= t_0 0.800000011920929)
(/ u0 (+ t_0 (/ cos2phi (* alphax alphax))))
(* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if (t_0 <= 0.800000011920929f) {
tmp = u0 / (t_0 + (cos2phi / (alphax * alphax)));
} else {
tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = sin2phi / (alphay * alphay)
if (t_0 <= 0.800000011920929e0) then
tmp = u0 / (t_0 + (cos2phi / (alphax * alphax)))
else
tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (t_0 <= Float32(0.800000011920929)) tmp = Float32(u0 / Float32(t_0 + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = sin2phi / (alphay * alphay); tmp = single(0.0); if (t_0 <= single(0.800000011920929)) tmp = u0 / (t_0 + (cos2phi / (alphax * alphax))); else tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;t\_0 \leq 0.800000011920929:\\
\;\;\;\;\frac{u0}{t\_0 + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 0.800000012Initial program 54.7%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3275.8
Applied rewrites75.8%
if 0.800000012 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 66.1%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3223.8
Applied rewrites23.7%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3287.4
Applied rewrites87.4%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3287.4
Applied rewrites87.4%
Taylor expanded in cos2phi around 0
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3286.6
Applied rewrites86.6%
Final simplification81.8%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11) (/ (- u0 (* u0 (* u0 -0.5))) (/ cos2phi (* alphax alphax))) (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (cos2phi / (alphax * alphax));
} else {
tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
tmp = (u0 - (u0 * (u0 * (-0.5e0)))) / (cos2phi / (alphax * alphax))
else
tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(cos2phi / Float32(alphax * alphax))); else tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11)) tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (cos2phi / (alphax * alphax)); else tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11Initial program 57.3%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f322.8
Applied rewrites2.9%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3286.1
Applied rewrites86.1%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
unpow2N/A
lower-*.f3260.8
Applied rewrites60.8%
if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.6%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3219.5
Applied rewrites19.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3288.6
Applied rewrites88.6%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3288.6
Applied rewrites88.6%
Taylor expanded in cos2phi around 0
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.5
Applied rewrites81.5%
Final simplification75.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- u0 (* u0 (* u0 -0.5))) (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 - (u0 * (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 - (u0 * (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 - (u0 * (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))); end
\begin{array}{l}
\\
\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 61.1%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3214.8
Applied rewrites14.7%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3287.9
Applied rewrites87.9%
Final simplification87.9%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (- 1.0 (* u0 -0.5))) (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f - (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 * (1.0e0 - (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) - Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) - (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 - u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 61.1%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3214.8
Applied rewrites14.7%
lower-+.f32N/A
lower-*.f3287.7
Applied rewrites87.7%
Final simplification87.7%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11) (/ (* (* alphax alphax) (+ u0 (* (* u0 u0) 0.5))) cos2phi) (* (* alphay alphay) (/ (- u0 (* -0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * 0.5f))) / cos2phi;
} else {
tmp = (alphay * alphay) * ((u0 - (-0.5f * (u0 * u0))) / sin2phi);
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * 0.5e0))) / cos2phi
else
tmp = (alphay * alphay) * ((u0 - ((-0.5e0) * (u0 * u0))) / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11)) tmp = Float32(Float32(Float32(alphax * alphax) * Float32(u0 + Float32(Float32(u0 * u0) * Float32(0.5)))) / cos2phi); else tmp = Float32(Float32(alphay * alphay) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11)) tmp = ((alphax * alphax) * (u0 + ((u0 * u0) * single(0.5)))) / cos2phi; else tmp = (alphay * alphay) * ((u0 - (single(-0.5) * (u0 * u0))) / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(alphax \cdot alphax\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot 0.5\right)}{cos2phi}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11Initial program 57.3%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f322.8
Applied rewrites2.9%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3286.1
Applied rewrites86.1%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
lower-+.f32N/A
lower-*.f32N/A
unpow2N/A
lower-*.f3260.8
Applied rewrites60.8%
if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.6%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3219.5
Applied rewrites19.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3288.6
Applied rewrites88.6%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3288.6
Applied rewrites88.6%
Taylor expanded in cos2phi around 0
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.5
Applied rewrites81.5%
Final simplification75.6%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (- u0 (* -0.5 (* u0 u0)))))
(if (<= (/ sin2phi (* alphay alphay)) 6.999999885293207e-11)
(* (* alphax alphax) (/ t_0 cos2phi))
(* (* alphay alphay) (/ t_0 sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = u0 - (-0.5f * (u0 * u0));
float tmp;
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11f) {
tmp = (alphax * alphax) * (t_0 / cos2phi);
} else {
tmp = (alphay * alphay) * (t_0 / sin2phi);
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = u0 - ((-0.5e0) * (u0 * u0))
if ((sin2phi / (alphay * alphay)) <= 6.999999885293207e-11) then
tmp = (alphax * alphax) * (t_0 / cos2phi)
else
tmp = (alphay * alphay) * (t_0 / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(6.999999885293207e-11)) tmp = Float32(Float32(alphax * alphax) * Float32(t_0 / cos2phi)); else tmp = Float32(Float32(alphay * alphay) * Float32(t_0 / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = u0 - (single(-0.5) * (u0 * u0)); tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(6.999999885293207e-11)) tmp = (alphax * alphax) * (t_0 / cos2phi); else tmp = (alphay * alphay) * (t_0 / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := u0 - -0.5 \cdot \left(u0 \cdot u0\right)\\
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 6.999999885293207 \cdot 10^{-11}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{t\_0}{cos2phi}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{t\_0}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 6.99999989e-11Initial program 57.3%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f322.8
Applied rewrites2.9%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3286.1
Applied rewrites86.1%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3286.0
Applied rewrites86.0%
Taylor expanded in cos2phi around inf
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3260.8
Applied rewrites60.8%
if 6.99999989e-11 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.6%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f3219.5
Applied rewrites19.5%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3288.6
Applied rewrites88.6%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3288.6
Applied rewrites88.6%
Taylor expanded in cos2phi around 0
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3281.5
Applied rewrites81.5%
Final simplification75.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10) (* (* alphax alphax) (/ (- u0 (* -0.5 (* u0 u0))) cos2phi)) (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
tmp = (alphax * alphax) * ((u0 - (-0.5f * (u0 * u0))) / cos2phi);
} else {
tmp = (u0 * (alphay * alphay)) / sin2phi;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
tmp = (alphax * alphax) * ((u0 - ((-0.5e0) * (u0 * u0))) / cos2phi)
else
tmp = (u0 * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10)) tmp = Float32(Float32(alphax * alphax) * Float32(Float32(u0 - Float32(Float32(-0.5) * Float32(u0 * u0))) / cos2phi)); else tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10)) tmp = (alphax * alphax) * ((u0 - (single(-0.5) * (u0 * u0))) / cos2phi); else tmp = (u0 * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0 - -0.5 \cdot \left(u0 \cdot u0\right)}{cos2phi}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10Initial program 56.8%
Taylor expanded in u0 around 0
lower-*.f32N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f322.9
Applied rewrites2.9%
distribute-rgt-inN/A
neg-mul-1N/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f3286.5
Applied rewrites86.5%
associate-/r*N/A
lower-/.f32N/A
lower-/.f3286.5
Applied rewrites86.5%
Taylor expanded in cos2phi around inf
associate-/l*N/A
div-subN/A
associate-*r/N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
associate-*r/N/A
div-subN/A
lower-/.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3260.1
Applied rewrites60.1%
if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.9%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3277.7
Applied rewrites77.7%
Taylor expanded in cos2phi around 0
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3272.8
Applied rewrites72.8%
Final simplification69.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10) (/ u0 (/ cos2phi (* alphax alphax))) (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
tmp = u0 / (cos2phi / (alphax * alphax));
} else {
tmp = (u0 * (alphay * alphay)) / sin2phi;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
tmp = u0 / (cos2phi / (alphax * alphax))
else
tmp = (u0 * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10)) tmp = Float32(u0 / Float32(cos2phi / Float32(alphax * alphax))); else tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10)) tmp = u0 / (cos2phi / (alphax * alphax)); else tmp = (u0 * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10Initial program 56.8%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3273.9
Applied rewrites73.9%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
unpow2N/A
lower-*.f3251.9
Applied rewrites51.9%
if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.9%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3277.7
Applied rewrites77.7%
Taylor expanded in cos2phi around 0
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3272.8
Applied rewrites72.8%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10) (* u0 (* (* alphax alphax) (/ 1.0 cos2phi))) (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
tmp = u0 * ((alphax * alphax) * (1.0f / cos2phi));
} else {
tmp = (u0 * (alphay * alphay)) / sin2phi;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
tmp = u0 * ((alphax * alphax) * (1.0e0 / cos2phi))
else
tmp = (u0 * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10)) tmp = Float32(u0 * Float32(Float32(alphax * alphax) * Float32(Float32(1.0) / cos2phi))); else tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10)) tmp = u0 * ((alphax * alphax) * (single(1.0) / cos2phi)); else tmp = (u0 * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;u0 \cdot \left(\left(alphax \cdot alphax\right) \cdot \frac{1}{cos2phi}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10Initial program 56.8%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3273.9
Applied rewrites73.9%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3251.9
Applied rewrites51.9%
lift-*.f32N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f32N/A
lower-/.f3251.9
Applied rewrites51.9%
lift-*.f32N/A
lift-/.f32N/A
*-commutativeN/A
lift-/.f32N/A
div-invN/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-/.f3251.9
Applied rewrites51.9%
if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.9%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3277.7
Applied rewrites77.7%
Taylor expanded in cos2phi around 0
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3272.8
Applied rewrites72.8%
Final simplification66.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 4.999999858590343e-10) (* (* alphax alphax) (/ u0 cos2phi)) (/ (* u0 (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10f) {
tmp = (alphax * alphax) * (u0 / cos2phi);
} else {
tmp = (u0 * (alphay * alphay)) / sin2phi;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: tmp
if ((sin2phi / (alphay * alphay)) <= 4.999999858590343e-10) then
tmp = (alphax * alphax) * (u0 / cos2phi)
else
tmp = (u0 * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(4.999999858590343e-10)) tmp = Float32(Float32(alphax * alphax) * Float32(u0 / cos2phi)); else tmp = Float32(Float32(u0 * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if ((sin2phi / (alphay * alphay)) <= single(4.999999858590343e-10)) tmp = (alphax * alphax) * (u0 / cos2phi); else tmp = (u0 * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.999999858590343 \cdot 10^{-10}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 4.99999986e-10Initial program 56.8%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3273.9
Applied rewrites73.9%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3251.9
Applied rewrites51.9%
lift-*.f32N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f32N/A
lower-/.f3251.9
Applied rewrites51.9%
if 4.99999986e-10 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 62.9%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3277.7
Applied rewrites77.7%
Taylor expanded in cos2phi around 0
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3272.8
Applied rewrites72.8%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (* (* alphax alphax) (/ u0 cos2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (alphax * alphax) * (u0 / cos2phi);
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (alphax * alphax) * (u0 / cos2phi)
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(alphax * alphax) * Float32(u0 / cos2phi)) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (alphax * alphax) * (u0 / cos2phi); end
\begin{array}{l}
\\
\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}
\end{array}
Initial program 61.1%
Taylor expanded in u0 around 0
lower-/.f32N/A
lower-+.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f32N/A
lower-/.f32N/A
unpow2N/A
lower-*.f3276.6
Applied rewrites76.6%
Taylor expanded in cos2phi around inf
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f3223.4
Applied rewrites23.4%
lift-*.f32N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f32N/A
lower-/.f3223.4
Applied rewrites23.4%
herbie shell --seed 2024216
(FPCore (alphax alphay u0 cos2phi sin2phi)
:name "Beckmann Distribution sample, tan2theta, alphax != alphay, u1 <= 0.5"
:precision binary32
:pre (and (and (and (and (and (<= 0.0001 alphax) (<= alphax 1.0)) (and (<= 0.0001 alphay) (<= alphay 1.0))) (and (<= 2.328306437e-10 u0) (<= u0 1.0))) (and (<= 0.0 cos2phi) (<= cos2phi 1.0))) (<= 0.0 sin2phi))
(/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))