
(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 13 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(log1p(Float32(-u0)) / Float32(Float32(Float32(-cos2phi) / Float32(alphax * alphax)) - Float32(Float32(sin2phi / alphay) / alphay))) end
\begin{array}{l}
\\
\frac{\mathsf{log1p}\left(-u0\right)}{\frac{-cos2phi}{alphax \cdot alphax} - \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr98.3%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Final simplification98.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(log1p(Float32(-u0)) / Float32(Float32(sin2phi / Float32(alphay * Float32(-alphay))) - Float32(cos2phi / Float32(alphax * alphax)))) end
\begin{array}{l}
\\
\frac{\mathsf{log1p}\left(-u0\right)}{\frac{sin2phi}{alphay \cdot \left(-alphay\right)} - \frac{cos2phi}{alphax \cdot alphax}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
Final simplification98.3%
(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(Float32(cos2phi / alphax) / alphax))) end
\begin{array}{l}
\\
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
sub-neg61.2%
log1p-define98.3%
neg-sub098.3%
associate--r+98.3%
neg-sub098.3%
associate-/r*98.3%
distribute-neg-frac298.3%
Simplified98.3%
Final simplification98.3%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 (+ 0.3333333333333333 (* u0 0.25))))))) (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f + (u0 * (0.3333333333333333f + (u0 * 0.25f))))))) / ((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 * (1.0e0 + (u0 * (0.5e0 + (u0 * (0.3333333333333333e0 + (u0 * 0.25e0))))))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) + Float32(u0 * Float32(Float32(0.3333333333333333) + Float32(u0 * Float32(0.25)))))))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) + (u0 * (single(0.3333333333333333) + (u0 * single(0.25)))))))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot \left(0.3333333333333333 + u0 \cdot 0.25\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr98.3%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Taylor expanded in u0 around 0 93.4%
*-commutative93.4%
Simplified93.4%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 (+ 0.3333333333333333 (* u0 0.25))))))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f + (u0 * (0.3333333333333333f + (u0 * 0.25f))))))) / ((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 * (1.0e0 + (u0 * (0.5e0 + (u0 * (0.3333333333333333e0 + (u0 * 0.25e0))))))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) + Float32(u0 * Float32(Float32(0.3333333333333333) + Float32(u0 * Float32(0.25)))))))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) + (u0 * (single(0.3333333333333333) + (u0 * single(0.25)))))))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot \left(0.3333333333333333 + u0 \cdot 0.25\right)\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
Taylor expanded in u0 around 0 93.3%
*-commutative93.4%
Simplified93.3%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay))))
(if (<= t_0 50.0)
(/ u0 (+ (/ cos2phi (* alphax alphax)) t_0))
(/
(*
(* alphay alphay)
(* u0 (- (* u0 (- 0.5 (* u0 -0.3333333333333333))) -1.0)))
sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float tmp;
if (t_0 <= 50.0f) {
tmp = u0 / ((cos2phi / (alphax * alphax)) + t_0);
} else {
tmp = ((alphay * alphay) * (u0 * ((u0 * (0.5f - (u0 * -0.3333333333333333f))) - -1.0f))) / sin2phi;
}
return tmp;
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
real(4) :: t_0
real(4) :: tmp
t_0 = sin2phi / (alphay * alphay)
if (t_0 <= 50.0e0) then
tmp = u0 / ((cos2phi / (alphax * alphax)) + t_0)
else
tmp = ((alphay * alphay) * (u0 * ((u0 * (0.5e0 - (u0 * (-0.3333333333333333e0)))) - (-1.0e0)))) / sin2phi
end if
code = tmp
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) tmp = Float32(0.0) if (t_0 <= Float32(50.0)) tmp = Float32(u0 / Float32(Float32(cos2phi / Float32(alphax * alphax)) + t_0)); else tmp = Float32(Float32(Float32(alphay * alphay) * Float32(u0 * Float32(Float32(u0 * Float32(Float32(0.5) - Float32(u0 * Float32(-0.3333333333333333)))) - Float32(-1.0)))) / sin2phi); end return tmp end
function tmp_2 = code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = sin2phi / (alphay * alphay); tmp = single(0.0); if (t_0 <= single(50.0)) tmp = u0 / ((cos2phi / (alphax * alphax)) + t_0); else tmp = ((alphay * alphay) * (u0 * ((u0 * (single(0.5) - (u0 * single(-0.3333333333333333)))) - single(-1.0)))) / sin2phi; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
\mathbf{if}\;t\_0 \leq 50:\\
\;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(u0 \cdot \left(u0 \cdot \left(0.5 - u0 \cdot -0.3333333333333333\right) - -1\right)\right)}{sin2phi}\\
\end{array}
\end{array}
if (/.f32 sin2phi (*.f32 alphay alphay)) < 50Initial program 56.8%
distribute-frac-neg56.8%
distribute-neg-frac256.8%
neg-mul-156.8%
associate-/r*56.8%
remove-double-neg56.8%
distribute-frac-neg56.8%
distribute-neg-frac256.8%
metadata-eval56.8%
/-rgt-identity56.8%
sub-neg56.8%
log1p-define98.8%
Simplified98.8%
Taylor expanded in u0 around 0 73.2%
if 50 < (/.f32 sin2phi (*.f32 alphay alphay)) Initial program 64.7%
distribute-frac-neg64.7%
distribute-neg-frac264.7%
sub-neg64.7%
log1p-define97.9%
neg-sub097.9%
associate--r+97.9%
neg-sub097.9%
associate-/r*97.9%
distribute-neg-frac297.9%
Simplified97.9%
Taylor expanded in u0 around 0 91.6%
Taylor expanded in cos2phi around 0 92.5%
unpow292.5%
Applied egg-rr92.5%
Final simplification84.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ (* u0 (- (* u0 -0.3333333333333333) 0.5)) -1.0)) (- (* (/ sin2phi alphay) (/ -1.0 alphay)) (/ (/ cos2phi alphax) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * ((u0 * ((u0 * -0.3333333333333333f) - 0.5f)) + -1.0f)) / (((sin2phi / alphay) * (-1.0f / 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.3333333333333333e0)) - 0.5e0)) + (-1.0e0))) / (((sin2phi / alphay) * ((-1.0e0) / alphay)) - ((cos2phi / alphax) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(u0 * Float32(Float32(u0 * Float32(-0.3333333333333333)) - Float32(0.5))) + Float32(-1.0))) / Float32(Float32(Float32(sin2phi / alphay) * Float32(Float32(-1.0) / alphay)) - Float32(Float32(cos2phi / alphax) / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * ((u0 * ((u0 * single(-0.3333333333333333)) - single(0.5))) + single(-1.0))) / (((sin2phi / alphay) * (single(-1.0) / alphay)) - ((cos2phi / alphax) / alphax)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(u0 \cdot \left(u0 \cdot -0.3333333333333333 - 0.5\right) + -1\right)}{\frac{sin2phi}{alphay} \cdot \frac{-1}{alphay} - \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
sub-neg61.2%
log1p-define98.3%
neg-sub098.3%
associate--r+98.3%
neg-sub098.3%
associate-/r*98.3%
distribute-neg-frac298.3%
Simplified98.3%
Taylor expanded in u0 around 0 91.0%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr91.1%
Final simplification91.1%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 0.3333333333333333))))) (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f + (u0 * 0.3333333333333333f))))) / ((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 * (1.0e0 + (u0 * (0.5e0 + (u0 * 0.3333333333333333e0))))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) + Float32(u0 * Float32(0.3333333333333333)))))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) + (u0 * single(0.3333333333333333)))))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot 0.3333333333333333\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr98.3%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Taylor expanded in u0 around 0 91.0%
*-commutative91.0%
Simplified91.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 0.3333333333333333))))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f + (u0 * 0.3333333333333333f))))) / ((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 * (1.0e0 + (u0 * (0.5e0 + (u0 * 0.3333333333333333e0))))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) + Float32(u0 * Float32(0.3333333333333333)))))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) + (u0 * single(0.3333333333333333)))))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot 0.3333333333333333\right)\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
Taylor expanded in u0 around 0 90.9%
*-commutative91.0%
Simplified90.9%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (+ u0 (* u0 (* u0 0.5))) (+ (/ cos2phi (* alphax alphax)) (* (/ sin2phi alphay) (/ 1.0 alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 + (u0 * (u0 * 0.5f))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (1.0f / 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) * (1.0e0 / alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 + Float32(u0 * Float32(u0 * Float32(0.5)))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) * Float32(Float32(1.0) / alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 + (u0 * (u0 * single(0.5)))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) * (single(1.0) / alphay))); end
\begin{array}{l}
\\
\frac{u0 + u0 \cdot \left(u0 \cdot 0.5\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay} \cdot \frac{1}{alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr98.3%
Taylor expanded in u0 around 0 86.5%
*-commutative86.5%
Simplified86.5%
distribute-rgt-in86.6%
*-un-lft-identity86.6%
Applied egg-rr86.6%
Final simplification86.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 0.5))) (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (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 * (1.0e0 + (u0 * 0.5e0))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(0.5)))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * single(0.5)))) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot 0.5\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
associate-/r*98.4%
div-inv98.3%
Applied egg-rr98.3%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Taylor expanded in u0 around 0 86.5%
*-commutative86.5%
Simplified86.5%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 0.5))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (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 * (1.0e0 + (u0 * 0.5e0))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(0.5)))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay)))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * single(0.5)))) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay))); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot 0.5\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\end{array}
Initial program 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
Taylor expanded in u0 around 0 86.5%
*-commutative86.5%
Simplified86.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(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 61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
neg-mul-161.2%
associate-/r*61.2%
remove-double-neg61.2%
distribute-frac-neg61.2%
distribute-neg-frac261.2%
metadata-eval61.2%
/-rgt-identity61.2%
sub-neg61.2%
log1p-define98.3%
Simplified98.3%
Taylor expanded in u0 around 0 75.9%
herbie shell --seed 2024143
(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)))))