
(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 (* alphay (/ (* (log1p (- u0)) (- alphax)) (fma alphay (/ cos2phi alphax) (/ alphax (/ alphay sin2phi))))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return alphay * ((log1pf(-u0) * -alphax) / fmaf(alphay, (cos2phi / alphax), (alphax / (alphay / sin2phi))));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(alphay * Float32(Float32(log1p(Float32(-u0)) * Float32(-alphax)) / fma(alphay, Float32(cos2phi / alphax), Float32(alphax / Float32(alphay / sin2phi))))) end
\begin{array}{l}
\\
alphay \cdot \frac{\mathsf{log1p}\left(-u0\right) \cdot \left(-alphax\right)}{\mathsf{fma}\left(alphay, \frac{cos2phi}{alphax}, \frac{alphax}{\frac{alphay}{sin2phi}}\right)}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
associate-/r*98.1%
div-inv98.0%
Applied egg-rr98.0%
div-inv98.1%
+-commutative98.1%
associate-/r*98.1%
frac-add97.7%
Applied egg-rr97.7%
div-inv97.7%
fma-def97.8%
*-commutative97.8%
*-commutative97.8%
Applied egg-rr97.8%
associate-*r/97.7%
*-rgt-identity97.7%
distribute-neg-frac97.7%
associate-/r/98.2%
distribute-lft-neg-in98.2%
distribute-frac-neg98.2%
associate-*r*98.2%
*-commutative98.2%
fma-udef98.2%
associate-*l/98.2%
associate-*l/98.2%
Simplified98.5%
Final simplification98.5%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= t_0 200.0)
(/
(- u0 (* u0 (* u0 -0.5)))
(+ (/ (/ cos2phi alphax) alphax) (/ (/ sin2phi alphay) alphay)))
(/ (- (log1p (- u0))) t_0))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if (t_0 <= 200.0f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (((cos2phi / alphax) / alphax) + ((sin2phi / alphay) / alphay));
} else {
tmp = -log1pf(-u0) / t_0;
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (t_0 <= Float32(200.0)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + Float32(Float32(sin2phi / alphay) / alphay))); else tmp = Float32(Float32(-log1p(Float32(-u0))) / t_0); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;t_0 \leq 200:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-u0\right)}{t_0}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 200Initial program 55.7%
neg-sub055.7%
div-sub55.7%
--rgt-identity55.7%
div-sub55.7%
--rgt-identity55.7%
sub-neg55.7%
+-commutative55.7%
neg-sub055.7%
associate-+l-55.7%
sub0-neg55.7%
neg-mul-155.7%
log-prod-0.0%
associate--r+-0.0%
Simplified98.7%
frac-2neg98.7%
div-inv98.7%
distribute-rgt-neg-in98.7%
Applied egg-rr98.7%
un-div-inv98.7%
distribute-rgt-neg-out98.7%
frac-2neg98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Taylor expanded in u0 around 0 87.4%
+-commutative87.4%
neg-mul-187.4%
unsub-neg87.4%
*-commutative87.4%
unpow287.4%
associate-*l*87.4%
Simplified87.4%
if 200 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 65.8%
neg-sub065.8%
div-sub65.8%
--rgt-identity65.8%
div-sub65.8%
--rgt-identity65.8%
neg-sub065.8%
sub-neg65.8%
log1p-def97.5%
Simplified97.5%
associate-/r*97.5%
div-inv97.5%
Applied egg-rr97.5%
Taylor expanded in cos2phi around 0 97.3%
unpow297.3%
Simplified97.3%
Final simplification92.6%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= (/ sin2phi (* alphay alphay)) 200.0)
(/
(- u0 (* u0 (* u0 -0.5)))
(+ (/ (/ cos2phi alphax) alphax) (/ (/ sin2phi alphay) alphay)))
(/ (* alphay (* (log1p (- u0)) (- alphay))) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 200.0f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (((cos2phi / alphax) / alphax) + ((sin2phi / alphay) / alphay));
} else {
tmp = (alphay * (log1pf(-u0) * -alphay)) / sin2phi;
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(200.0)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + Float32(Float32(sin2phi / alphay) / alphay))); else tmp = Float32(Float32(alphay * Float32(log1p(Float32(-u0)) * Float32(-alphay))) / sin2phi); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 200:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{alphay \cdot \left(\mathsf{log1p}\left(-u0\right) \cdot \left(-alphay\right)\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 200Initial program 55.7%
neg-sub055.7%
div-sub55.7%
--rgt-identity55.7%
div-sub55.7%
--rgt-identity55.7%
sub-neg55.7%
+-commutative55.7%
neg-sub055.7%
associate-+l-55.7%
sub0-neg55.7%
neg-mul-155.7%
log-prod-0.0%
associate--r+-0.0%
Simplified98.7%
frac-2neg98.7%
div-inv98.7%
distribute-rgt-neg-in98.7%
Applied egg-rr98.7%
un-div-inv98.7%
distribute-rgt-neg-out98.7%
frac-2neg98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Taylor expanded in u0 around 0 87.4%
+-commutative87.4%
neg-mul-187.4%
unsub-neg87.4%
*-commutative87.4%
unpow287.4%
associate-*l*87.4%
Simplified87.4%
if 200 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 65.8%
neg-sub065.8%
div-sub65.8%
--rgt-identity65.8%
div-sub65.8%
--rgt-identity65.8%
sub-neg65.8%
+-commutative65.8%
neg-sub065.8%
associate-+l-65.8%
sub0-neg65.8%
neg-mul-165.8%
log-prod-0.0%
associate--r+-0.0%
Simplified97.5%
frac-2neg97.5%
div-inv97.4%
distribute-rgt-neg-in97.4%
Applied egg-rr97.4%
un-div-inv97.5%
distribute-rgt-neg-out97.5%
frac-2neg97.5%
associate-/r*97.6%
Applied egg-rr97.6%
clear-num97.4%
inv-pow97.4%
Applied egg-rr97.4%
unpow-197.4%
associate-/r/97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in cos2phi around 0 67.2%
associate-*r/67.2%
mul-1-neg67.2%
unpow267.2%
associate-*l*67.2%
sub-neg67.2%
log1p-def98.7%
Simplified98.7%
Final simplification93.4%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(if (<= (/ sin2phi (* alphay alphay)) 200.0)
(/
(- u0 (* u0 (* u0 -0.5)))
(+ (/ (/ cos2phi alphax) alphax) (/ (/ sin2phi alphay) alphay)))
(/ (* (log1p (- u0)) (* alphay (- alphay))) sin2phi)))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 200.0f) {
tmp = (u0 - (u0 * (u0 * -0.5f))) / (((cos2phi / alphax) / alphax) + ((sin2phi / alphay) / alphay));
} else {
tmp = (log1pf(-u0) * (alphay * -alphay)) / sin2phi;
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) tmp = Float32(0.0) if (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(200.0)) tmp = Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + Float32(Float32(sin2phi / alphay) / alphay))); else tmp = Float32(Float32(log1p(Float32(-u0)) * Float32(alphay * Float32(-alphay))) / sin2phi); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 200:\\
\;\;\;\;\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(-u0\right) \cdot \left(alphay \cdot \left(-alphay\right)\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 200Initial program 55.7%
neg-sub055.7%
div-sub55.7%
--rgt-identity55.7%
div-sub55.7%
--rgt-identity55.7%
sub-neg55.7%
+-commutative55.7%
neg-sub055.7%
associate-+l-55.7%
sub0-neg55.7%
neg-mul-155.7%
log-prod-0.0%
associate--r+-0.0%
Simplified98.7%
frac-2neg98.7%
div-inv98.7%
distribute-rgt-neg-in98.7%
Applied egg-rr98.7%
un-div-inv98.7%
distribute-rgt-neg-out98.7%
frac-2neg98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Taylor expanded in u0 around 0 87.4%
+-commutative87.4%
neg-mul-187.4%
unsub-neg87.4%
*-commutative87.4%
unpow287.4%
associate-*l*87.4%
Simplified87.4%
if 200 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 65.8%
neg-sub065.8%
div-sub65.8%
--rgt-identity65.8%
div-sub65.8%
--rgt-identity65.8%
neg-sub065.8%
sub-neg65.8%
log1p-def97.5%
Simplified97.5%
associate-/r*97.5%
div-inv97.5%
Applied egg-rr97.5%
Taylor expanded in cos2phi around 0 67.2%
associate-*r/67.2%
mul-1-neg67.2%
unpow267.2%
*-commutative67.2%
sub-neg67.2%
log1p-def98.8%
Simplified98.8%
Final simplification93.4%
(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 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
Final simplification98.0%
(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 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
sub-neg61.0%
+-commutative61.0%
neg-sub061.0%
associate-+l-61.0%
sub0-neg61.0%
neg-mul-161.0%
log-prod-0.0%
associate--r+-0.0%
Simplified98.1%
Final simplification98.1%
(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(Float32(sin2phi / alphay) / alphay))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
sub-neg61.0%
+-commutative61.0%
neg-sub061.0%
associate-+l-61.0%
sub0-neg61.0%
neg-mul-161.0%
log-prod-0.0%
associate--r+-0.0%
Simplified98.1%
frac-2neg98.1%
div-inv98.0%
distribute-rgt-neg-in98.0%
Applied egg-rr98.0%
un-div-inv98.1%
distribute-rgt-neg-out98.1%
frac-2neg98.1%
associate-/r*98.1%
Applied egg-rr98.1%
Final simplification98.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (- u0 (* u0 (* u0 -0.5))) (+ (/ (/ cos2phi alphax) alphax) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 - (u0 * (u0 * -0.5f))) / (((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 - (u0 * (u0 * (-0.5e0)))) / (((cos2phi / alphax) / alphax) + ((sin2phi / alphay) / alphay))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 - Float32(u0 * Float32(u0 * Float32(-0.5)))) / Float32(Float32(Float32(cos2phi / alphax) / alphax) + Float32(Float32(sin2phi / alphay) / alphay))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 - (u0 * (u0 * single(-0.5)))) / (((cos2phi / alphax) / alphax) + ((sin2phi / alphay) / alphay)); end
\begin{array}{l}
\\
\frac{u0 - u0 \cdot \left(u0 \cdot -0.5\right)}{\frac{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
sub-neg61.0%
+-commutative61.0%
neg-sub061.0%
associate-+l-61.0%
sub0-neg61.0%
neg-mul-161.0%
log-prod-0.0%
associate--r+-0.0%
Simplified98.1%
frac-2neg98.1%
div-inv98.0%
distribute-rgt-neg-in98.0%
Applied egg-rr98.0%
un-div-inv98.1%
distribute-rgt-neg-out98.1%
frac-2neg98.1%
associate-/r*98.1%
Applied egg-rr98.1%
Taylor expanded in u0 around 0 86.6%
+-commutative86.6%
neg-mul-186.6%
unsub-neg86.6%
*-commutative86.6%
unpow286.6%
associate-*l*86.6%
Simplified86.6%
Final simplification86.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (* alphay alphax)) (+ (/ (* alphax sin2phi) alphay) (/ (* alphay cos2phi) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (alphay * alphax)) / (((alphax * sin2phi) / alphay) + ((alphay * cos2phi) / 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 * (alphay * alphax)) / (((alphax * sin2phi) / alphay) + ((alphay * cos2phi) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(alphay * alphax)) / Float32(Float32(Float32(alphax * sin2phi) / alphay) + Float32(Float32(alphay * cos2phi) / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (alphay * alphax)) / (((alphax * sin2phi) / alphay) + ((alphay * cos2phi) / alphax)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(alphay \cdot alphax\right)}{\frac{alphax \cdot sin2phi}{alphay} + \frac{alphay \cdot cos2phi}{alphax}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
associate-/r*98.1%
div-inv98.0%
Applied egg-rr98.0%
div-inv98.1%
+-commutative98.1%
associate-/r*98.1%
frac-add97.7%
Applied egg-rr97.7%
Taylor expanded in u0 around 0 74.8%
Final simplification74.8%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (if (<= (/ sin2phi (* alphay alphay)) 3.000000106112566e-7) (* alphax (/ u0 (/ cos2phi alphax))) (* (* alphay alphay) (/ u0 sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float tmp;
if ((sin2phi / (alphay * alphay)) <= 3.000000106112566e-7f) {
tmp = alphax * (u0 / (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 / (alphay * alphay)) <= 3.000000106112566e-7) then
tmp = alphax * (u0 / (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 (Float32(sin2phi / Float32(alphay * alphay)) <= Float32(3.000000106112566e-7)) tmp = Float32(alphax * Float32(u0 / 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 / (alphay * alphay)) <= single(3.000000106112566e-7)) tmp = alphax * (u0 / (cos2phi / 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 3.000000106112566 \cdot 10^{-7}:\\
\;\;\;\;alphax \cdot \frac{u0}{\frac{cos2phi}{alphax}}\\
\mathbf{else}:\\
\;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 3.0000001e-7Initial program 55.9%
neg-sub055.9%
div-sub55.9%
--rgt-identity55.9%
div-sub55.9%
--rgt-identity55.9%
neg-sub055.9%
sub-neg55.9%
log1p-def98.5%
Simplified98.5%
Taylor expanded in u0 around 0 74.6%
unpow274.6%
unpow274.6%
Simplified74.6%
Taylor expanded in cos2phi around inf 53.9%
unpow253.9%
associate-/l*53.9%
associate-/r/53.9%
Simplified53.9%
add-log-exp20.7%
exp-prod14.2%
Applied egg-rr14.2%
log-pow19.7%
associate-*l*19.7%
rem-log-exp53.9%
Simplified53.9%
Taylor expanded in alphax around 0 53.9%
*-commutative53.9%
unpow253.9%
associate-*l*53.9%
associate-*r/53.9%
*-commutative53.9%
associate-/l*53.9%
Simplified53.9%
if 3.0000001e-7 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 64.1%
neg-sub064.1%
div-sub64.1%
--rgt-identity64.1%
div-sub64.1%
--rgt-identity64.1%
neg-sub064.1%
sub-neg64.1%
log1p-def97.7%
Simplified97.7%
Taylor expanded in u0 around 0 74.5%
unpow274.5%
unpow274.5%
Simplified74.5%
Taylor expanded in cos2phi around 0 73.2%
unpow273.2%
associate-/l*72.5%
associate-/r/73.3%
Simplified73.3%
Final simplification66.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ u0 (+ (/ sin2phi (* alphay alphay)) (/ cos2phi (* alphax alphax)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return u0 / ((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 / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(u0 / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(cos2phi / Float32(alphax * alphax)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = u0 / ((sin2phi / (alphay * alphay)) + (cos2phi / (alphax * alphax))); end
\begin{array}{l}
\\
\frac{u0}{\frac{sin2phi}{alphay \cdot alphay} + \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.5%
unpow274.5%
unpow274.5%
Simplified74.5%
Final simplification74.5%
(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(Float32(cos2phi / 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{\frac{cos2phi}{alphax}}{alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.5%
unpow274.5%
unpow274.5%
Simplified74.5%
associate-/r*98.1%
div-inv98.0%
Applied egg-rr74.5%
div-inv74.6%
Applied egg-rr74.6%
Final simplification74.6%
(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(Float32(cos2phi / alphax) / alphax) + Float32(Float32(sin2phi / 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{\frac{cos2phi}{alphax}}{alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
sub-neg61.0%
+-commutative61.0%
neg-sub061.0%
associate-+l-61.0%
sub0-neg61.0%
neg-mul-161.0%
log-prod-0.0%
associate--r+-0.0%
Simplified98.1%
frac-2neg98.1%
div-inv98.0%
distribute-rgt-neg-in98.0%
Applied egg-rr98.0%
un-div-inv98.1%
distribute-rgt-neg-out98.1%
frac-2neg98.1%
associate-/r*98.1%
Applied egg-rr98.1%
Taylor expanded in u0 around 0 74.6%
neg-mul-174.6%
Simplified74.6%
Final simplification74.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(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 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.5%
unpow274.5%
unpow274.5%
Simplified74.5%
Taylor expanded in cos2phi around inf 25.7%
unpow225.7%
associate-/l*25.7%
associate-/r/25.7%
Simplified25.7%
add-log-exp11.5%
exp-prod8.8%
Applied egg-rr8.8%
log-pow11.2%
associate-*l*11.2%
rem-log-exp25.7%
Simplified25.7%
Final simplification25.7%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (* alphax (/ u0 (/ cos2phi alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return alphax * (u0 / (cos2phi / 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 = alphax * (u0 / (cos2phi / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(alphax * Float32(u0 / Float32(cos2phi / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = alphax * (u0 / (cos2phi / alphax)); end
\begin{array}{l}
\\
alphax \cdot \frac{u0}{\frac{cos2phi}{alphax}}
\end{array}
Initial program 61.0%
neg-sub061.0%
div-sub61.0%
--rgt-identity61.0%
div-sub61.0%
--rgt-identity61.0%
neg-sub061.0%
sub-neg61.0%
log1p-def98.0%
Simplified98.0%
Taylor expanded in u0 around 0 74.5%
unpow274.5%
unpow274.5%
Simplified74.5%
Taylor expanded in cos2phi around inf 25.7%
unpow225.7%
associate-/l*25.7%
associate-/r/25.7%
Simplified25.7%
add-log-exp11.5%
exp-prod8.8%
Applied egg-rr8.8%
log-pow11.2%
associate-*l*11.2%
rem-log-exp25.7%
Simplified25.7%
Taylor expanded in alphax around 0 25.7%
*-commutative25.7%
unpow225.7%
associate-*l*25.7%
associate-*r/25.7%
*-commutative25.7%
associate-/l*25.7%
Simplified25.7%
Final simplification25.7%
herbie shell --seed 2023229
(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)))))