
(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 14 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 (/ (- (log1p (- u0))) (+ (/ (/ cos2phi alphax) alphax) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -log1pf(-u0) / (((cos2phi / alphax) / alphax) + (sin2phi / (alphay * alphay)));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log1p(Float32(-u0))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + Float32(sin2phi / Float32(alphay * alphay)))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 59.3%
neg-sub059.3%
div-sub59.3%
--rgt-identity59.3%
div-sub59.3%
--rgt-identity59.3%
sub-neg59.3%
+-commutative59.3%
neg-sub059.3%
associate-+l-59.3%
sub0-neg59.3%
neg-mul-159.3%
log-prod-0.0%
associate--r+-0.0%
Simplified98.7%
Final simplification98.7%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= t_0 9.999999747378752e-6)
(/
(- u0 (* u0 (* u0 -0.5)))
(+ t_0 (/ 1.0 (/ (* alphax alphax) cos2phi))))
(/ (- (* (log1p (- u0)) (* alphay alphay))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if (t_0 <= 9.999999747378752e-6f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (t_0 + (1.0f / ((alphax * alphax) / cos2phi)));
} else {
tmp = -(log1pf(-u0) * (alphay * alphay)) / sin2phi;
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (t_0 <= Float32(9.999999747378752e-6)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(t_0 + Float32(Float32(1.0) / Float32(Float32(alphax * alphax) / cos2phi)))); else tmp = Float32(Float32(-Float32(log1p(Float32(-u0)) * Float32(alphay * alphay))) / sin2phi); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;t_0 \leq 9.999999747378752 \cdot 10^{-6}:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{t_0 + \frac{1}{\frac{alphax \cdot alphax}{cos2phi}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-u0\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 9.99999975e-6Initial program 53.8%
neg-sub053.8%
div-sub53.8%
--rgt-identity53.8%
div-sub53.8%
--rgt-identity53.8%
neg-sub053.8%
sub-neg53.8%
log1p-def98.6%
Simplified98.6%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.6%
clear-num98.7%
associate-*r/98.6%
Applied egg-rr98.6%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 86.1%
+-commutative86.1%
neg-mul-186.1%
unsub-neg86.1%
*-commutative86.1%
unpow286.1%
associate-*l*86.1%
Simplified86.1%
if 9.99999975e-6 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 63.1%
neg-sub063.1%
div-sub63.1%
--rgt-identity63.1%
div-sub63.1%
--rgt-identity63.1%
neg-sub063.1%
sub-neg63.1%
log1p-def98.8%
Simplified98.8%
Taylor expanded in cos2phi around 0 62.6%
mul-1-neg62.6%
unpow262.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in alphay around 0 62.6%
sub-neg62.6%
log1p-def97.7%
unpow297.7%
Simplified97.7%
Final simplification92.9%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- (log1p (- u0))) (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -log1pf(-u0) / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-log1p(Float32(-u0))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 59.3%
neg-sub059.3%
div-sub59.3%
--rgt-identity59.3%
div-sub59.3%
--rgt-identity59.3%
neg-sub059.3%
sub-neg59.3%
log1p-def98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- u0 (* u0 (* u0 -0.5))) (+ (/ sin2phi (* alphay alphay)) (/ 1.0 (/ (* alphax alphax) cos2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 - (u0 * (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + (1.0f / ((alphax * alphax) / 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 = (u0 - (u0 * (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + (1.0e0 / ((alphax * alphax) / cos2phi)))
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(Float32(1.0) / Float32(Float32(alphax * alphax) / cos2phi)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 - (u0 * (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + (single(1.0) / ((alphax * alphax) / cos2phi))); end
\begin{array}{l}
\\
\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{1}{\frac{alphax \cdot alphax}{cos2phi}}}
\end{array}
Initial program 59.3%
neg-sub059.3%
div-sub59.3%
--rgt-identity59.3%
div-sub59.3%
--rgt-identity59.3%
neg-sub059.3%
sub-neg59.3%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.7%
clear-num98.7%
associate-*r/98.7%
Applied egg-rr98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 87.0%
+-commutative87.0%
neg-mul-187.0%
unsub-neg87.0%
*-commutative87.0%
unpow287.0%
associate-*l*87.0%
Simplified87.0%
Final simplification87.0%
(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 59.3%
neg-sub059.3%
div-sub59.3%
--rgt-identity59.3%
div-sub59.3%
--rgt-identity59.3%
neg-sub059.3%
sub-neg59.3%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.7%
clear-num98.7%
associate-*r/98.7%
Applied egg-rr98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 87.0%
+-commutative87.0%
neg-mul-187.0%
unsub-neg87.0%
*-commutative87.0%
unpow287.0%
associate-*l*87.0%
Simplified87.0%
Taylor expanded in alphax around 0 87.0%
unpow287.0%
Simplified87.0%
Final simplification87.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999873689376e-6) (/ u0 (- (/ sin2phi (* alphay alphay)) (/ (/ 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 <= 4.999999873689376e-6f) {
tmp = u0 / ((sin2phi / (alphay * alphay)) - ((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 <= 4.999999873689376e-6) then
tmp = u0 / ((sin2phi / (alphay * alphay)) - ((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 (sin2phi <= Float32(4.999999873689376e-6)) tmp = Float32(u0 / Float32(Float32(sin2phi / Float32(alphay * alphay)) - Float32(Float32(cos2phi / alphax) / Float32(-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 <= single(4.999999873689376e-6)) tmp = u0 / ((sin2phi / (alphay * alphay)) - ((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}\;sin2phi \leq 4.999999873689376 \cdot 10^{-6}:\\
\;\;\;\;\frac{u0}{\frac{sin2phi}{alphay \cdot alphay} - \frac{\frac{cos2phi}{alphax}}{-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 sin2phi < 4.99999987e-6Initial program 55.4%
neg-sub055.4%
div-sub55.4%
--rgt-identity55.4%
div-sub55.4%
--rgt-identity55.4%
neg-sub055.4%
sub-neg55.4%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 74.1%
unpow274.1%
unpow274.1%
Simplified74.1%
associate-/r*74.3%
frac-2neg74.3%
distribute-frac-neg74.3%
Applied egg-rr74.3%
if 4.99999987e-6 < sin2phi Initial program 62.4%
neg-sub062.4%
div-sub62.4%
--rgt-identity62.4%
div-sub62.4%
--rgt-identity62.4%
neg-sub062.4%
sub-neg62.4%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.7%
clear-num98.7%
associate-*r/98.7%
Applied egg-rr98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 88.4%
+-commutative88.4%
neg-mul-188.4%
unsub-neg88.4%
*-commutative88.4%
unpow288.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in alphax around inf 88.3%
associate-/l*88.1%
associate-/r/88.4%
cancel-sign-sub-inv88.4%
metadata-eval88.4%
unpow288.4%
unpow288.4%
Simplified88.4%
Final simplification82.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999918875795e-18) (/ (* alphax alphax) (/ cos2phi u0)) (* (* alphay alphay) (/ (+ u0 (* 0.5 (* u0 u0))) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999918875795e-18f) {
tmp = (alphax * alphax) / (cos2phi / u0);
} 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 <= 4.999999918875795e-18) then
tmp = (alphax * alphax) / (cos2phi / u0)
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 (sin2phi <= Float32(4.999999918875795e-18)) tmp = Float32(Float32(alphax * alphax) / Float32(cos2phi / u0)); 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 <= single(4.999999918875795e-18)) tmp = (alphax * alphax) / (cos2phi / u0); else tmp = (alphay * alphay) * ((u0 + (single(0.5) * (u0 * u0))) / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999918875795 \cdot 10^{-18}:\\
\;\;\;\;\frac{alphax \cdot alphax}{\frac{cos2phi}{u0}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0 + 0.5 \cdot \left(u0 \cdot u0\right)}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 4.99999992e-18Initial program 54.3%
neg-sub054.3%
div-sub54.3%
--rgt-identity54.3%
div-sub54.3%
--rgt-identity54.3%
neg-sub054.3%
sub-neg54.3%
log1p-def98.4%
Simplified98.4%
Taylor expanded in u0 around 0 75.2%
unpow275.2%
unpow275.2%
Simplified75.2%
Taylor expanded in cos2phi around inf 55.6%
unpow255.6%
*-commutative55.6%
*-lft-identity55.6%
times-frac55.5%
/-rgt-identity55.5%
Simplified55.5%
Taylor expanded in alphax around 0 55.6%
*-commutative55.6%
associate-/l*55.8%
unpow255.8%
Simplified55.8%
if 4.99999992e-18 < sin2phi Initial program 61.6%
neg-sub061.6%
div-sub61.6%
--rgt-identity61.6%
div-sub61.6%
--rgt-identity61.6%
neg-sub061.6%
sub-neg61.6%
log1p-def98.8%
Simplified98.8%
associate-/r*98.8%
div-inv98.8%
Applied egg-rr98.8%
un-div-inv98.8%
associate-/r*98.8%
clear-num98.8%
associate-*r/98.8%
Applied egg-rr98.8%
associate-*r/98.8%
Simplified98.8%
Taylor expanded in u0 around 0 87.3%
+-commutative87.3%
neg-mul-187.3%
unsub-neg87.3%
*-commutative87.3%
unpow287.3%
associate-*l*87.3%
Simplified87.3%
Taylor expanded in alphax around inf 82.2%
associate-/l*82.0%
associate-/r/82.3%
cancel-sign-sub-inv82.3%
metadata-eval82.3%
unpow282.3%
unpow282.3%
Simplified82.3%
Final simplification74.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999873689376e-6) (/ u0 (+ (/ sin2phi (* alphay alphay)) (/ 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 <= 4.999999873689376e-6f) {
tmp = u0 / ((sin2phi / (alphay * alphay)) + (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 <= 4.999999873689376e-6) then
tmp = u0 / ((sin2phi / (alphay * alphay)) + (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 (sin2phi <= Float32(4.999999873689376e-6)) tmp = Float32(u0 / Float32(Float32(sin2phi / Float32(alphay * alphay)) + 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 <= single(4.999999873689376e-6)) tmp = u0 / ((sin2phi / (alphay * alphay)) + (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}\;sin2phi \leq 4.999999873689376 \cdot 10^{-6}:\\
\;\;\;\;\frac{u0}{\frac{sin2phi}{alphay \cdot alphay} + \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 sin2phi < 4.99999987e-6Initial program 55.4%
neg-sub055.4%
div-sub55.4%
--rgt-identity55.4%
div-sub55.4%
--rgt-identity55.4%
neg-sub055.4%
sub-neg55.4%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 74.1%
unpow274.1%
unpow274.1%
Simplified74.1%
if 4.99999987e-6 < sin2phi Initial program 62.4%
neg-sub062.4%
div-sub62.4%
--rgt-identity62.4%
div-sub62.4%
--rgt-identity62.4%
neg-sub062.4%
sub-neg62.4%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.7%
clear-num98.7%
associate-*r/98.7%
Applied egg-rr98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 88.4%
+-commutative88.4%
neg-mul-188.4%
unsub-neg88.4%
*-commutative88.4%
unpow288.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in alphax around inf 88.3%
associate-/l*88.1%
associate-/r/88.4%
cancel-sign-sub-inv88.4%
metadata-eval88.4%
unpow288.4%
unpow288.4%
Simplified88.4%
Final simplification82.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999873689376e-6) (/ 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 <= 4.999999873689376e-6f) {
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 <= 4.999999873689376e-6) 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 (sin2phi <= Float32(4.999999873689376e-6)) 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 <= single(4.999999873689376e-6)) 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}\;sin2phi \leq 4.999999873689376 \cdot 10^{-6}:\\
\;\;\;\;\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 sin2phi < 4.99999987e-6Initial program 55.4%
neg-sub055.4%
div-sub55.4%
--rgt-identity55.4%
div-sub55.4%
--rgt-identity55.4%
neg-sub055.4%
sub-neg55.4%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
Taylor expanded in u0 around 0 74.1%
unpow274.1%
unpow274.1%
associate-/r*74.2%
Simplified74.2%
if 4.99999987e-6 < sin2phi Initial program 62.4%
neg-sub062.4%
div-sub62.4%
--rgt-identity62.4%
div-sub62.4%
--rgt-identity62.4%
neg-sub062.4%
sub-neg62.4%
log1p-def98.7%
Simplified98.7%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.7%
associate-/r*98.7%
clear-num98.7%
associate-*r/98.7%
Applied egg-rr98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in u0 around 0 88.4%
+-commutative88.4%
neg-mul-188.4%
unsub-neg88.4%
*-commutative88.4%
unpow288.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in alphax around inf 88.3%
associate-/l*88.1%
associate-/r/88.4%
cancel-sign-sub-inv88.4%
metadata-eval88.4%
unpow288.4%
unpow288.4%
Simplified88.4%
Final simplification82.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999918875795e-18) (* alphax (* alphax (/ u0 cos2phi))) (* u0 (* alphay (/ alphay sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999918875795e-18f) {
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 <= 4.999999918875795e-18) 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 (sin2phi <= Float32(4.999999918875795e-18)) tmp = Float32(alphax * Float32(alphax * Float32(u0 / cos2phi))); else tmp = Float32(u0 * Float32(alphay * Float32(alphay / sin2phi))); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999918875795e-18)) tmp = alphax * (alphax * (u0 / cos2phi)); else tmp = u0 * (alphay * (alphay / sin2phi)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999918875795 \cdot 10^{-18}:\\
\;\;\;\;alphax \cdot \left(alphax \cdot \frac{u0}{cos2phi}\right)\\
\mathbf{else}:\\
\;\;\;\;u0 \cdot \left(alphay \cdot \frac{alphay}{sin2phi}\right)\\
\end{array}
\end{array}
if sin2phi < 4.99999992e-18Initial program 54.3%
neg-sub054.3%
div-sub54.3%
--rgt-identity54.3%
div-sub54.3%
--rgt-identity54.3%
neg-sub054.3%
sub-neg54.3%
log1p-def98.4%
Simplified98.4%
Taylor expanded in u0 around 0 75.2%
unpow275.2%
unpow275.2%
Simplified75.2%
Taylor expanded in cos2phi around inf 55.6%
unpow255.6%
*-commutative55.6%
*-lft-identity55.6%
times-frac55.5%
/-rgt-identity55.5%
Simplified55.5%
Taylor expanded in alphax around 0 55.6%
*-commutative55.6%
associate-*r/55.5%
unpow255.5%
associate-*r*55.7%
*-commutative55.7%
associate-*l/55.7%
Simplified55.7%
expm1-log1p-u55.5%
expm1-udef50.5%
associate-/l*50.5%
Applied egg-rr50.5%
expm1-def55.5%
expm1-log1p55.7%
associate-/r/55.7%
Simplified55.7%
if 4.99999992e-18 < sin2phi Initial program 61.6%
neg-sub061.6%
div-sub61.6%
--rgt-identity61.6%
div-sub61.6%
--rgt-identity61.6%
neg-sub061.6%
sub-neg61.6%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 76.5%
unpow276.5%
unpow276.5%
Simplified76.5%
frac-2neg76.5%
div-inv76.5%
distribute-rgt-neg-in76.5%
Applied egg-rr76.5%
Taylor expanded in cos2phi around 0 72.4%
associate-*r/72.5%
unpow272.5%
associate-*l/72.5%
*-commutative72.5%
Simplified72.5%
Final simplification67.2%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999918875795e-18) (* u0 (/ alphax (/ cos2phi alphax))) (* u0 (* alphay (/ alphay sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999918875795e-18f) {
tmp = u0 * (alphax / (cos2phi / 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 <= 4.999999918875795e-18) then
tmp = u0 * (alphax / (cos2phi / 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 (sin2phi <= Float32(4.999999918875795e-18)) tmp = Float32(u0 * Float32(alphax / Float32(cos2phi / alphax))); else tmp = Float32(u0 * Float32(alphay * Float32(alphay / sin2phi))); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999918875795e-18)) tmp = u0 * (alphax / (cos2phi / alphax)); else tmp = u0 * (alphay * (alphay / sin2phi)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999918875795 \cdot 10^{-18}:\\
\;\;\;\;u0 \cdot \frac{alphax}{\frac{cos2phi}{alphax}}\\
\mathbf{else}:\\
\;\;\;\;u0 \cdot \left(alphay \cdot \frac{alphay}{sin2phi}\right)\\
\end{array}
\end{array}
if sin2phi < 4.99999992e-18Initial program 54.3%
neg-sub054.3%
div-sub54.3%
--rgt-identity54.3%
div-sub54.3%
--rgt-identity54.3%
neg-sub054.3%
sub-neg54.3%
log1p-def98.4%
Simplified98.4%
Taylor expanded in u0 around 0 75.2%
unpow275.2%
unpow275.2%
Simplified75.2%
div-inv75.2%
+-commutative75.2%
Applied egg-rr75.2%
Taylor expanded in sin2phi around 0 55.7%
unpow255.7%
associate-/l*55.7%
Simplified55.7%
if 4.99999992e-18 < sin2phi Initial program 61.6%
neg-sub061.6%
div-sub61.6%
--rgt-identity61.6%
div-sub61.6%
--rgt-identity61.6%
neg-sub061.6%
sub-neg61.6%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 76.5%
unpow276.5%
unpow276.5%
Simplified76.5%
frac-2neg76.5%
div-inv76.5%
distribute-rgt-neg-in76.5%
Applied egg-rr76.5%
Taylor expanded in cos2phi around 0 72.4%
associate-*r/72.5%
unpow272.5%
associate-*l/72.5%
*-commutative72.5%
Simplified72.5%
Final simplification67.2%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999918875795e-18) (* u0 (/ alphax (/ cos2phi alphax))) (* (* alphay alphay) (/ u0 sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999918875795e-18f) {
tmp = u0 * (alphax / (cos2phi / alphax));
} else {
tmp = (alphay * alphay) * (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 <= 4.999999918875795e-18) then
tmp = u0 * (alphax / (cos2phi / alphax))
else
tmp = (alphay * alphay) * (u0 / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(4.999999918875795e-18)) tmp = Float32(u0 * Float32(alphax / Float32(cos2phi / alphax))); else tmp = Float32(Float32(alphay * alphay) * Float32(u0 / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999918875795e-18)) tmp = u0 * (alphax / (cos2phi / alphax)); else tmp = (alphay * alphay) * (u0 / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999918875795 \cdot 10^{-18}:\\
\;\;\;\;u0 \cdot \frac{alphax}{\frac{cos2phi}{alphax}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 4.99999992e-18Initial program 54.3%
neg-sub054.3%
div-sub54.3%
--rgt-identity54.3%
div-sub54.3%
--rgt-identity54.3%
neg-sub054.3%
sub-neg54.3%
log1p-def98.4%
Simplified98.4%
Taylor expanded in u0 around 0 75.2%
unpow275.2%
unpow275.2%
Simplified75.2%
div-inv75.2%
+-commutative75.2%
Applied egg-rr75.2%
Taylor expanded in sin2phi around 0 55.7%
unpow255.7%
associate-/l*55.7%
Simplified55.7%
if 4.99999992e-18 < sin2phi Initial program 61.6%
neg-sub061.6%
div-sub61.6%
--rgt-identity61.6%
div-sub61.6%
--rgt-identity61.6%
neg-sub061.6%
sub-neg61.6%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 76.5%
unpow276.5%
unpow276.5%
Simplified76.5%
frac-2neg76.5%
div-inv76.5%
distribute-rgt-neg-in76.5%
Applied egg-rr76.5%
Taylor expanded in cos2phi around 0 72.4%
associate-*l/72.5%
*-commutative72.5%
unpow272.5%
Simplified72.5%
Final simplification67.3%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999918875795e-18) (/ (* alphax alphax) (/ cos2phi u0)) (* (* alphay alphay) (/ u0 sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999918875795e-18f) {
tmp = (alphax * alphax) / (cos2phi / u0);
} else {
tmp = (alphay * alphay) * (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 <= 4.999999918875795e-18) then
tmp = (alphax * alphax) / (cos2phi / u0)
else
tmp = (alphay * alphay) * (u0 / sin2phi)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(4.999999918875795e-18)) tmp = Float32(Float32(alphax * alphax) / Float32(cos2phi / u0)); else tmp = Float32(Float32(alphay * alphay) * Float32(u0 / sin2phi)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999918875795e-18)) tmp = (alphax * alphax) / (cos2phi / u0); else tmp = (alphay * alphay) * (u0 / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999918875795 \cdot 10^{-18}:\\
\;\;\;\;\frac{alphax \cdot alphax}{\frac{cos2phi}{u0}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 4.99999992e-18Initial program 54.3%
neg-sub054.3%
div-sub54.3%
--rgt-identity54.3%
div-sub54.3%
--rgt-identity54.3%
neg-sub054.3%
sub-neg54.3%
log1p-def98.4%
Simplified98.4%
Taylor expanded in u0 around 0 75.2%
unpow275.2%
unpow275.2%
Simplified75.2%
Taylor expanded in cos2phi around inf 55.6%
unpow255.6%
*-commutative55.6%
*-lft-identity55.6%
times-frac55.5%
/-rgt-identity55.5%
Simplified55.5%
Taylor expanded in alphax around 0 55.6%
*-commutative55.6%
associate-/l*55.8%
unpow255.8%
Simplified55.8%
if 4.99999992e-18 < sin2phi Initial program 61.6%
neg-sub061.6%
div-sub61.6%
--rgt-identity61.6%
div-sub61.6%
--rgt-identity61.6%
neg-sub061.6%
sub-neg61.6%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 76.5%
unpow276.5%
unpow276.5%
Simplified76.5%
frac-2neg76.5%
div-inv76.5%
distribute-rgt-neg-in76.5%
Applied egg-rr76.5%
Taylor expanded in cos2phi around 0 72.4%
associate-*l/72.5%
*-commutative72.5%
unpow272.5%
Simplified72.5%
Final simplification67.3%
(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(alphax * Float32(alphax * Float32(u0 / cos2phi))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = alphax * (alphax * (u0 / cos2phi)); end
\begin{array}{l}
\\
alphax \cdot \left(alphax \cdot \frac{u0}{cos2phi}\right)
\end{array}
Initial program 59.3%
neg-sub059.3%
div-sub59.3%
--rgt-identity59.3%
div-sub59.3%
--rgt-identity59.3%
neg-sub059.3%
sub-neg59.3%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 76.1%
unpow276.1%
unpow276.1%
Simplified76.1%
Taylor expanded in cos2phi around inf 24.5%
unpow224.5%
*-commutative24.5%
*-lft-identity24.5%
times-frac24.5%
/-rgt-identity24.5%
Simplified24.5%
Taylor expanded in alphax around 0 24.5%
*-commutative24.5%
associate-*r/24.5%
unpow224.5%
associate-*r*24.6%
*-commutative24.6%
associate-*l/24.6%
Simplified24.6%
expm1-log1p-u24.5%
expm1-udef22.6%
associate-/l*22.6%
Applied egg-rr22.6%
expm1-def24.5%
expm1-log1p24.6%
associate-/r/24.6%
Simplified24.6%
Final simplification24.6%
herbie shell --seed 2023174
(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)))))