
(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 15 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))
(fma (* alphay (/ alphay sin2phi)) (/ cos2phi alphax) alphax)))
(* alphay (* (/ alphay sin2phi) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return -(log1pf(-u0) / fmaf((alphay * (alphay / sin2phi)), (cos2phi / alphax), alphax)) * (alphay * ((alphay / sin2phi) * alphax));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(-Float32(log1p(Float32(-u0)) / fma(Float32(alphay * Float32(alphay / sin2phi)), Float32(cos2phi / alphax), alphax))) * Float32(alphay * Float32(Float32(alphay / sin2phi) * alphax))) end
\begin{array}{l}
\\
\left(-\frac{\mathsf{log1p}\left(-u0\right)}{\mathsf{fma}\left(alphay \cdot \frac{alphay}{sin2phi}, \frac{cos2phi}{alphax}, alphax\right)}\right) \cdot \left(alphay \cdot \left(\frac{alphay}{sin2phi} \cdot alphax\right)\right)
\end{array}
Initial program 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
+-commutative98.0%
clear-num97.9%
associate-/r*97.8%
frac-add97.5%
*-un-lft-identity97.5%
associate-/l*97.4%
associate-/l*97.6%
Applied egg-rr97.6%
expm1-log1p-u95.9%
expm1-udef48.5%
associate-/r/48.5%
+-commutative48.5%
fma-def48.5%
associate-/r/48.5%
*-commutative48.5%
associate-/r/48.5%
Applied egg-rr48.5%
expm1-def96.6%
expm1-log1p98.3%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Final simplification98.2%
(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(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
Final simplification98.0%
(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(Float32(sin2phi / alphay) / alphay) + Float32(cos2phi / Float32(alphax * alphax)))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
+-commutative98.0%
clear-num97.9%
associate-/r*97.8%
frac-add97.5%
*-un-lft-identity97.5%
associate-/l*97.4%
associate-/l*97.6%
Applied egg-rr97.6%
Taylor expanded in alphax around 0 98.0%
unpow298.0%
unpow298.0%
+-commutative98.0%
associate-/r*98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= sin2phi 9.999999960041972e-12)
(/
(- u0 (* (* u0 u0) -0.5))
(+ (/ (/ sin2phi alphay) alphay) (/ cos2phi (* alphax alphax))))
(* (log1p (- u0)) (/ (- alphay) (/ sin2phi alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 9.999999960041972e-12f) {
tmp = (u0 - ((u0 * u0) * -0.5f)) / (((sin2phi / alphay) / alphay) + (cos2phi / (alphax * alphax)));
} else {
tmp = log1pf(-u0) * (-alphay / (sin2phi / alphay));
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(9.999999960041972e-12)) tmp = Float32(Float32(u0 - Float32(Float32(u0 * u0) * Float32(-0.5))) / Float32(Float32(Float32(sin2phi / alphay) / alphay) + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(log1p(Float32(-u0)) * Float32(Float32(-alphay) / Float32(sin2phi / alphay))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 9.999999960041972 \cdot 10^{-12}:\\
\;\;\;\;\frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(-u0\right) \cdot \frac{-alphay}{\frac{sin2phi}{alphay}}\\
\end{array}
\end{array}
if sin2phi < 9.99999996e-12Initial program 58.5%
neg-sub058.5%
div-sub58.5%
--rgt-identity58.5%
div-sub58.5%
--rgt-identity58.5%
neg-sub058.5%
sub-neg58.5%
log1p-def98.7%
Simplified98.7%
+-commutative98.7%
clear-num98.5%
associate-/r*98.3%
frac-add98.2%
*-un-lft-identity98.2%
associate-/l*97.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in alphax around 0 98.7%
unpow298.7%
unpow298.7%
+-commutative98.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in u0 around 0 86.0%
+-commutative86.0%
neg-mul-186.0%
unsub-neg86.0%
*-commutative86.0%
unpow286.0%
Simplified86.0%
if 9.99999996e-12 < sin2phi Initial program 60.2%
neg-sub060.2%
div-sub60.2%
--rgt-identity60.2%
div-sub60.2%
--rgt-identity60.2%
neg-sub060.2%
sub-neg60.2%
log1p-def97.6%
Simplified97.6%
Taylor expanded in cos2phi around 0 60.7%
mul-1-neg60.7%
unpow260.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in alphay around 0 60.7%
associate-/l*60.1%
sub-neg60.1%
neg-mul-160.1%
log1p-def95.3%
neg-mul-195.3%
associate-/r/96.6%
unpow296.6%
associate-*l/96.7%
*-commutative96.7%
associate-/r/96.6%
Simplified96.6%
Final simplification92.6%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= sin2phi 9.999999960041972e-12)
(/
(- u0 (* (* u0 u0) -0.5))
(+ (/ (/ sin2phi alphay) alphay) (/ cos2phi (* alphax alphax))))
(/ (* alphay (* (log1p (- u0)) (- alphay))) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 9.999999960041972e-12f) {
tmp = (u0 - ((u0 * u0) * -0.5f)) / (((sin2phi / alphay) / alphay) + (cos2phi / (alphax * alphax)));
} else {
tmp = (alphay * (log1pf(-u0) * -alphay)) / sin2phi;
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(9.999999960041972e-12)) tmp = Float32(Float32(u0 - Float32(Float32(u0 * u0) * Float32(-0.5))) / Float32(Float32(Float32(sin2phi / alphay) / alphay) + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(Float32(alphay * Float32(log1p(Float32(-u0)) * Float32(-alphay))) / sin2phi); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 9.999999960041972 \cdot 10^{-12}:\\
\;\;\;\;\frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\frac{alphay \cdot \left(\mathsf{log1p}\left(-u0\right) \cdot \left(-alphay\right)\right)}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 9.99999996e-12Initial program 58.5%
neg-sub058.5%
div-sub58.5%
--rgt-identity58.5%
div-sub58.5%
--rgt-identity58.5%
neg-sub058.5%
sub-neg58.5%
log1p-def98.7%
Simplified98.7%
+-commutative98.7%
clear-num98.5%
associate-/r*98.3%
frac-add98.2%
*-un-lft-identity98.2%
associate-/l*97.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in alphax around 0 98.7%
unpow298.7%
unpow298.7%
+-commutative98.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in u0 around 0 86.0%
+-commutative86.0%
neg-mul-186.0%
unsub-neg86.0%
*-commutative86.0%
unpow286.0%
Simplified86.0%
if 9.99999996e-12 < sin2phi Initial program 60.2%
neg-sub060.2%
div-sub60.2%
--rgt-identity60.2%
div-sub60.2%
--rgt-identity60.2%
neg-sub060.2%
sub-neg60.2%
log1p-def97.6%
Simplified97.6%
Taylor expanded in cos2phi around 0 60.7%
mul-1-neg60.7%
unpow260.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in alphay around 0 60.7%
sub-neg60.7%
neg-mul-160.7%
log1p-def96.3%
neg-mul-196.3%
unpow296.3%
associate-*l*96.6%
Simplified96.6%
Final simplification92.7%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= sin2phi 9.999999960041972e-12)
(/
(- u0 (* (* u0 u0) -0.5))
(+ (/ (/ sin2phi alphay) alphay) (/ cos2phi (* alphax alphax))))
(* alphay (* alphay (/ (- (log1p (- u0))) sin2phi)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 9.999999960041972e-12f) {
tmp = (u0 - ((u0 * u0) * -0.5f)) / (((sin2phi / alphay) / alphay) + (cos2phi / (alphax * alphax)));
} else {
tmp = alphay * (alphay * (-log1pf(-u0) / sin2phi));
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(9.999999960041972e-12)) tmp = Float32(Float32(u0 - Float32(Float32(u0 * u0) * Float32(-0.5))) / Float32(Float32(Float32(sin2phi / alphay) / alphay) + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(alphay * Float32(alphay * Float32(Float32(-log1p(Float32(-u0))) / sin2phi))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 9.999999960041972 \cdot 10^{-12}:\\
\;\;\;\;\frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;alphay \cdot \left(alphay \cdot \frac{-\mathsf{log1p}\left(-u0\right)}{sin2phi}\right)\\
\end{array}
\end{array}
if sin2phi < 9.99999996e-12Initial program 58.5%
neg-sub058.5%
div-sub58.5%
--rgt-identity58.5%
div-sub58.5%
--rgt-identity58.5%
neg-sub058.5%
sub-neg58.5%
log1p-def98.7%
Simplified98.7%
+-commutative98.7%
clear-num98.5%
associate-/r*98.3%
frac-add98.2%
*-un-lft-identity98.2%
associate-/l*97.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in alphax around 0 98.7%
unpow298.7%
unpow298.7%
+-commutative98.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in u0 around 0 86.0%
+-commutative86.0%
neg-mul-186.0%
unsub-neg86.0%
*-commutative86.0%
unpow286.0%
Simplified86.0%
if 9.99999996e-12 < sin2phi Initial program 60.2%
neg-sub060.2%
div-sub60.2%
--rgt-identity60.2%
div-sub60.2%
--rgt-identity60.2%
neg-sub060.2%
sub-neg60.2%
log1p-def97.6%
Simplified97.6%
+-commutative97.6%
clear-num97.5%
associate-/r*97.5%
frac-add97.2%
*-un-lft-identity97.2%
associate-/l*97.2%
associate-/l*97.3%
Applied egg-rr97.3%
Taylor expanded in alphax around 0 97.6%
unpow297.6%
unpow297.6%
+-commutative97.6%
associate-/r*97.7%
Simplified97.7%
Taylor expanded in sin2phi around inf 60.7%
associate-*r/60.7%
*-commutative60.7%
associate-*r*60.7%
sub-neg60.7%
log1p-def96.3%
neg-mul-196.3%
*-commutative96.3%
associate-*r/96.6%
unpow296.6%
associate-*l*96.6%
distribute-frac-neg96.6%
Simplified96.6%
Final simplification92.7%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= sin2phi 9.999999960041972e-12)
(/
(- u0 (* (* u0 u0) -0.5))
(+ (/ (/ sin2phi alphay) alphay) (/ cos2phi (* alphax alphax))))
(* (/ (- (log1p (- u0))) sin2phi) (* alphay alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 9.999999960041972e-12f) {
tmp = (u0 - ((u0 * u0) * -0.5f)) / (((sin2phi / alphay) / alphay) + (cos2phi / (alphax * alphax)));
} else {
tmp = (-log1pf(-u0) / sin2phi) * (alphay * alphay);
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(9.999999960041972e-12)) tmp = Float32(Float32(u0 - Float32(Float32(u0 * u0) * Float32(-0.5))) / Float32(Float32(Float32(sin2phi / alphay) / alphay) + Float32(cos2phi / Float32(alphax * alphax)))); else tmp = Float32(Float32(Float32(-log1p(Float32(-u0))) / sin2phi) * Float32(alphay * alphay)); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 9.999999960041972 \cdot 10^{-12}:\\
\;\;\;\;\frac{u0 - \left(u0 \cdot u0\right) \cdot -0.5}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-u0\right)}{sin2phi} \cdot \left(alphay \cdot alphay\right)\\
\end{array}
\end{array}
if sin2phi < 9.99999996e-12Initial program 58.5%
neg-sub058.5%
div-sub58.5%
--rgt-identity58.5%
div-sub58.5%
--rgt-identity58.5%
neg-sub058.5%
sub-neg58.5%
log1p-def98.7%
Simplified98.7%
+-commutative98.7%
clear-num98.5%
associate-/r*98.3%
frac-add98.2%
*-un-lft-identity98.2%
associate-/l*97.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in alphax around 0 98.7%
unpow298.7%
unpow298.7%
+-commutative98.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in u0 around 0 86.0%
+-commutative86.0%
neg-mul-186.0%
unsub-neg86.0%
*-commutative86.0%
unpow286.0%
Simplified86.0%
if 9.99999996e-12 < sin2phi Initial program 60.2%
neg-sub060.2%
div-sub60.2%
--rgt-identity60.2%
div-sub60.2%
--rgt-identity60.2%
neg-sub060.2%
sub-neg60.2%
log1p-def97.6%
Simplified97.6%
+-commutative97.6%
clear-num97.5%
associate-/r*97.5%
frac-add97.2%
*-un-lft-identity97.2%
associate-/l*97.2%
associate-/l*97.3%
Applied egg-rr97.3%
Taylor expanded in alphax around inf 95.3%
unpow295.3%
Simplified95.3%
associate-/r/96.6%
Applied egg-rr96.6%
Final simplification92.7%
(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(Float32(u0 * u0) * Float32(-0.5))) / Float32(Float32(Float32(sin2phi / 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 - \left(u0 \cdot u0\right) \cdot -0.5}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
+-commutative98.0%
clear-num97.9%
associate-/r*97.8%
frac-add97.5%
*-un-lft-identity97.5%
associate-/l*97.4%
associate-/l*97.6%
Applied egg-rr97.6%
Taylor expanded in alphax around 0 98.0%
unpow298.0%
unpow298.0%
+-commutative98.0%
associate-/r*98.0%
Simplified98.0%
Taylor expanded in u0 around 0 87.1%
+-commutative87.1%
neg-mul-187.1%
unsub-neg87.1%
*-commutative87.1%
unpow287.1%
Simplified87.1%
Final simplification87.1%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= sin2phi 4.999999969612645e-9)
(/
u0
(+ (/ cos2phi (* alphax alphax)) (* (/ sin2phi alphay) (/ 1.0 alphay))))
(/ (* (- u0 (* u0 (* u0 -0.5))) (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999969612645e-9f) {
tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (1.0f / alphay)));
} else {
tmp = ((u0 - (u0 * (u0 * -0.5f))) * (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.999999969612645e-9) then
tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (1.0e0 / alphay)))
else
tmp = ((u0 - (u0 * (u0 * (-0.5e0)))) * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(4.999999969612645e-9)) tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) * Float32(Float32(1.0) / alphay)))); else tmp = Float32(Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999969612645e-9)) tmp = u0 / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (single(1.0) / alphay))); else tmp = ((u0 - (u0 * (u0 * single(-0.5)))) * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999969612645 \cdot 10^{-9}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(u0 - u0 \cdot \left(u0 \cdot -0.5\right)\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 4.99999997e-9Initial program 58.9%
neg-sub058.9%
div-sub58.9%
--rgt-identity58.9%
div-sub58.9%
--rgt-identity58.9%
neg-sub058.9%
sub-neg58.9%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 72.1%
unpow272.1%
unpow272.1%
Simplified72.1%
associate-/r*72.2%
div-inv72.2%
Applied egg-rr72.2%
if 4.99999997e-9 < sin2phi Initial program 59.9%
neg-sub059.9%
div-sub59.9%
--rgt-identity59.9%
div-sub59.9%
--rgt-identity59.9%
neg-sub059.9%
sub-neg59.9%
log1p-def97.6%
Simplified97.6%
Taylor expanded in cos2phi around 0 60.4%
mul-1-neg60.4%
unpow260.4%
*-commutative60.4%
Simplified60.4%
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%
Final simplification81.4%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 1.999999936531045e-19) (/ 1.0 (/ cos2phi (* u0 (* alphax alphax)))) (* (* alphay alphay) (/ u0 sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 1.999999936531045e-19f) {
tmp = 1.0f / (cos2phi / (u0 * (alphax * 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 / (alphay * alphay)) <= 1.999999936531045e-19) then
tmp = 1.0e0 / (cos2phi / (u0 * (alphax * 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 (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(1.999999936531045e-19)) tmp = Float32(Float32(1.0) / Float32(cos2phi / Float32(u0 * Float32(alphax * 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 / (alphay * alphay)) <= single(1.999999936531045e-19)) tmp = single(1.0) / (cos2phi / (u0 * (alphax * alphax))); else tmp = (alphay * alphay) * (u0 / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 1.999999936531045 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\frac{cos2phi}{u0 \cdot \left(alphax \cdot alphax\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 1.99999994e-19Initial program 54.5%
neg-sub054.5%
div-sub54.5%
--rgt-identity54.5%
div-sub54.5%
--rgt-identity54.5%
neg-sub054.5%
sub-neg54.5%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 73.8%
unpow273.8%
unpow273.8%
Simplified73.8%
Taylor expanded in cos2phi around inf 61.9%
associate-/l*62.0%
unpow262.0%
Simplified62.0%
associate-/l*61.9%
pow261.9%
clear-num62.1%
inv-pow62.1%
pow262.1%
Applied egg-rr62.1%
unpow-162.1%
Simplified62.1%
if 1.99999994e-19 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 60.8%
neg-sub060.8%
div-sub60.8%
--rgt-identity60.8%
div-sub60.8%
--rgt-identity60.8%
neg-sub060.8%
sub-neg60.8%
log1p-def97.8%
Simplified97.8%
Taylor expanded in u0 around 0 75.0%
unpow275.0%
unpow275.0%
Simplified75.0%
frac-2neg75.0%
div-inv75.0%
distribute-rgt-neg-in75.0%
Applied egg-rr75.0%
un-div-inv75.0%
distribute-rgt-neg-out75.0%
frac-2neg75.0%
associate-/r*75.0%
Applied egg-rr75.0%
Taylor expanded in cos2phi around 0 69.5%
associate-/l*69.2%
associate-/r/69.7%
unpow269.7%
Simplified69.7%
Final simplification68.2%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 4.999999969612645e-9) (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))) (/ (* (- u0 (* u0 (* u0 -0.5))) (* alphay alphay)) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 4.999999969612645e-9f) {
tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
} else {
tmp = ((u0 - (u0 * (u0 * -0.5f))) * (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.999999969612645e-9) then
tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
else
tmp = ((u0 - (u0 * (u0 * (-0.5e0)))) * (alphay * alphay)) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(4.999999969612645e-9)) tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))); else tmp = Float32(Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) * Float32(alphay * alphay)) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(4.999999969612645e-9)) tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); else tmp = ((u0 - (u0 * (u0 * single(-0.5)))) * (alphay * alphay)) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 4.999999969612645 \cdot 10^{-9}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(u0 - u0 \cdot \left(u0 \cdot -0.5\right)\right) \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\
\end{array}
\end{array}
if sin2phi < 4.99999997e-9Initial program 58.9%
neg-sub058.9%
div-sub58.9%
--rgt-identity58.9%
div-sub58.9%
--rgt-identity58.9%
neg-sub058.9%
sub-neg58.9%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 72.1%
unpow272.1%
unpow272.1%
Simplified72.1%
if 4.99999997e-9 < sin2phi Initial program 59.9%
neg-sub059.9%
div-sub59.9%
--rgt-identity59.9%
div-sub59.9%
--rgt-identity59.9%
neg-sub059.9%
sub-neg59.9%
log1p-def97.6%
Simplified97.6%
Taylor expanded in cos2phi around 0 60.4%
mul-1-neg60.4%
unpow260.4%
*-commutative60.4%
Simplified60.4%
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%
Final simplification81.3%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 1.999999936531045e-19) (/ u0 (/ cos2phi (* alphax alphax))) (* (* alphay alphay) (/ u0 sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 1.999999936531045e-19f) {
tmp = u0 / (cos2phi / (alphax * 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 / (alphay * alphay)) <= 1.999999936531045e-19) then
tmp = u0 / (cos2phi / (alphax * 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 (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(1.999999936531045e-19)) tmp = Float32(u0 / Float32(cos2phi / Float32(alphax * 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 / (alphay * alphay)) <= single(1.999999936531045e-19)) tmp = u0 / (cos2phi / (alphax * alphax)); else tmp = (alphay * alphay) * (u0 / sin2phi); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 1.999999936531045 \cdot 10^{-19}:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 1.99999994e-19Initial program 54.5%
neg-sub054.5%
div-sub54.5%
--rgt-identity54.5%
div-sub54.5%
--rgt-identity54.5%
neg-sub054.5%
sub-neg54.5%
log1p-def98.8%
Simplified98.8%
Taylor expanded in u0 around 0 73.8%
unpow273.8%
unpow273.8%
Simplified73.8%
Taylor expanded in cos2phi around inf 61.9%
associate-/l*62.0%
unpow262.0%
Simplified62.0%
if 1.99999994e-19 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 60.8%
neg-sub060.8%
div-sub60.8%
--rgt-identity60.8%
div-sub60.8%
--rgt-identity60.8%
neg-sub060.8%
sub-neg60.8%
log1p-def97.8%
Simplified97.8%
Taylor expanded in u0 around 0 75.0%
unpow275.0%
unpow275.0%
Simplified75.0%
frac-2neg75.0%
div-inv75.0%
distribute-rgt-neg-in75.0%
Applied egg-rr75.0%
un-div-inv75.0%
distribute-rgt-neg-out75.0%
frac-2neg75.0%
associate-/r*75.0%
Applied egg-rr75.0%
Taylor expanded in cos2phi around 0 69.5%
associate-/l*69.2%
associate-/r/69.7%
unpow269.7%
Simplified69.7%
Final simplification68.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ u0 (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return 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 = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = u0 / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.8%
unpow274.8%
unpow274.8%
Simplified74.8%
Final simplification74.8%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= sin2phi 2.600000079049072e-20) (* (* alphax alphax) (/ u0 cos2phi)) (* (/ u0 sin2phi) (* alphay alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if (sin2phi <= 2.600000079049072e-20f) {
tmp = (alphax * alphax) * (u0 / cos2phi);
} else {
tmp = (u0 / sin2phi) * (alphay * alphay);
}
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 <= 2.600000079049072e-20) then
tmp = (alphax * alphax) * (u0 / cos2phi)
else
tmp = (u0 / sin2phi) * (alphay * alphay)
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (sin2phi <= Float32(2.600000079049072e-20)) tmp = Float32(Float32(alphax * alphax) * Float32(u0 / cos2phi)); else tmp = Float32(Float32(u0 / sin2phi) * Float32(alphay * alphay)); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = single(0.0); if (sin2phi <= single(2.600000079049072e-20)) tmp = (alphax * alphax) * (u0 / cos2phi); else tmp = (u0 / sin2phi) * (alphay * alphay); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sin2phi \leq 2.600000079049072 \cdot 10^{-20}:\\
\;\;\;\;\left(alphax \cdot alphax\right) \cdot \frac{u0}{cos2phi}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0}{sin2phi} \cdot \left(alphay \cdot alphay\right)\\
\end{array}
\end{array}
if sin2phi < 2.60000008e-20Initial program 58.1%
neg-sub058.1%
div-sub58.1%
--rgt-identity58.1%
div-sub58.1%
--rgt-identity58.1%
neg-sub058.1%
sub-neg58.1%
log1p-def98.7%
Simplified98.7%
Taylor expanded in u0 around 0 72.0%
unpow272.0%
unpow272.0%
Simplified72.0%
Taylor expanded in cos2phi around inf 56.1%
associate-/l*56.2%
unpow256.2%
Simplified56.2%
Taylor expanded in u0 around 0 56.1%
unpow256.1%
associate-*l/56.1%
Simplified56.1%
if 2.60000008e-20 < sin2phi Initial program 60.0%
neg-sub060.0%
div-sub60.0%
--rgt-identity60.0%
div-sub60.0%
--rgt-identity60.0%
neg-sub060.0%
sub-neg60.0%
log1p-def97.8%
Simplified97.8%
Taylor expanded in u0 around 0 75.7%
unpow275.7%
unpow275.7%
Simplified75.7%
frac-2neg75.7%
div-inv75.6%
distribute-rgt-neg-in75.6%
Applied egg-rr75.6%
un-div-inv75.7%
distribute-rgt-neg-out75.7%
frac-2neg75.7%
associate-/r*75.7%
Applied egg-rr75.7%
Taylor expanded in cos2phi around 0 71.2%
associate-/l*70.9%
associate-/r/71.4%
unpow271.4%
Simplified71.4%
Final simplification67.6%
(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 59.5%
neg-sub059.5%
div-sub59.5%
--rgt-identity59.5%
div-sub59.5%
--rgt-identity59.5%
neg-sub059.5%
sub-neg59.5%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.8%
unpow274.8%
unpow274.8%
Simplified74.8%
Taylor expanded in cos2phi around inf 23.0%
associate-/l*23.0%
unpow223.0%
Simplified23.0%
Taylor expanded in u0 around 0 23.0%
unpow223.0%
associate-*l/23.0%
Simplified23.0%
Final simplification23.0%
herbie shell --seed 2023208
(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)))))