
(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)) (- (/ cos2phi (* alphax (- alphax))) (* (pow alphay -2.0) sin2phi))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return log1pf(-u0) / ((cos2phi / (alphax * -alphax)) - (powf(alphay, -2.0f) * sin2phi));
}
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(log1p(Float32(-u0)) / Float32(Float32(cos2phi / Float32(alphax * Float32(-alphax))) - Float32((alphay ^ Float32(-2.0)) * sin2phi))) end
\begin{array}{l}
\\
\frac{\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot \left(-alphax\right)} - {alphay}^{-2} \cdot sin2phi}
\end{array}
Initial program 61.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
neg-mul-161.4%
associate-/r*61.4%
metadata-eval61.4%
distribute-neg-frac261.4%
/-rgt-identity61.4%
sub-neg61.4%
log1p-define98.1%
Simplified98.1%
clear-num98.1%
associate-/r/98.1%
pow298.1%
pow-flip98.2%
metadata-eval98.2%
Applied egg-rr98.2%
Final simplification98.2%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ (/ cos2phi alphax) alphax)))
(if (<= (- 1.0 u0) 0.8880000114440918)
(/ (log1p (- u0)) (- t_0 (/ (/ sin2phi alphay) alphay)))
(/
(* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 (- 0.3333333333333333 (* u0 -0.25)))))))
(+ (/ sin2phi (* alphay alphay)) t_0)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = (cos2phi / alphax) / alphax;
float tmp;
if ((1.0f - u0) <= 0.8880000114440918f) {
tmp = log1pf(-u0) / (t_0 - ((sin2phi / alphay) / alphay));
} else {
tmp = (u0 * (1.0f + (u0 * (0.5f + (u0 * (0.3333333333333333f - (u0 * -0.25f))))))) / ((sin2phi / (alphay * alphay)) + t_0);
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(Float32(cos2phi / alphax) / alphax) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.8880000114440918)) tmp = Float32(log1p(Float32(-u0)) / Float32(t_0 - Float32(Float32(sin2phi / alphay) / alphay))); else tmp = 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(sin2phi / Float32(alphay * alphay)) + t_0)); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{cos2phi}{alphax}}{alphax}\\
\mathbf{if}\;1 - u0 \leq 0.8880000114440918:\\
\;\;\;\;\frac{\mathsf{log1p}\left(-u0\right)}{t\_0 - \frac{\frac{sin2phi}{alphay}}{alphay}}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot \left(0.3333333333333333 - u0 \cdot -0.25\right)\right)\right)}{\frac{sin2phi}{alphay \cdot alphay} + t\_0}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.888000011Initial program 95.6%
distribute-frac-neg95.6%
distribute-neg-frac295.6%
sub-neg95.6%
log1p-define96.0%
neg-sub096.0%
associate--r+96.0%
neg-sub096.0%
associate-/r*95.9%
distribute-neg-frac295.9%
Simplified95.9%
add-sqr-sqrt-0.0%
sqrt-unprod75.8%
sqr-neg75.8%
sqrt-prod75.8%
add-sqr-sqrt75.8%
div-inv75.8%
Applied egg-rr75.8%
associate-*r/75.8%
*-rgt-identity75.8%
Simplified75.8%
associate-/r*96.0%
div-inv95.8%
Applied egg-rr75.7%
associate-*r/96.0%
*-rgt-identity96.0%
Simplified75.9%
if 0.888000011 < (-.f32 #s(literal 1 binary32) u0) Initial program 56.6%
distribute-frac-neg56.6%
distribute-neg-frac256.6%
sub-neg56.6%
log1p-define98.4%
neg-sub098.4%
associate--r+98.4%
neg-sub098.4%
associate-/r*98.3%
distribute-neg-frac298.3%
Simplified98.3%
Taylor expanded in u0 around 0 97.5%
Final simplification94.9%
(FPCore (alphax alphay u0 cos2phi sin2phi)
:precision binary32
(let* ((t_0 (/ sin2phi (* alphay alphay)))
(t_1 (/ (/ cos2phi alphax) alphax)))
(if (<= (- 1.0 u0) 0.8880000114440918)
(/ (log1p (- u0)) (- t_1 t_0))
(/
(* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 (- 0.3333333333333333 (* u0 -0.25)))))))
(+ t_0 t_1)))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
float t_0 = sin2phi / (alphay * alphay);
float t_1 = (cos2phi / alphax) / alphax;
float tmp;
if ((1.0f - u0) <= 0.8880000114440918f) {
tmp = log1pf(-u0) / (t_1 - t_0);
} else {
tmp = (u0 * (1.0f + (u0 * (0.5f + (u0 * (0.3333333333333333f - (u0 * -0.25f))))))) / (t_0 + t_1);
}
return tmp;
}
function code(alphax, alphay, u0, cos2phi, sin2phi) t_0 = Float32(sin2phi / Float32(alphay * alphay)) t_1 = Float32(Float32(cos2phi / alphax) / alphax) tmp = Float32(0.0) if (Float32(Float32(1.0) - u0) <= Float32(0.8880000114440918)) tmp = Float32(log1p(Float32(-u0)) / Float32(t_1 - t_0)); else tmp = 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(t_0 + t_1)); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sin2phi}{alphay \cdot alphay}\\
t_1 := \frac{\frac{cos2phi}{alphax}}{alphax}\\
\mathbf{if}\;1 - u0 \leq 0.8880000114440918:\\
\;\;\;\;\frac{\mathsf{log1p}\left(-u0\right)}{t\_1 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 + u0 \cdot \left(0.3333333333333333 - u0 \cdot -0.25\right)\right)\right)}{t\_0 + t\_1}\\
\end{array}
\end{array}
if (-.f32 #s(literal 1 binary32) u0) < 0.888000011Initial program 95.6%
distribute-frac-neg95.6%
distribute-neg-frac295.6%
sub-neg95.6%
log1p-define96.0%
neg-sub096.0%
associate--r+96.0%
neg-sub096.0%
associate-/r*95.9%
distribute-neg-frac295.9%
Simplified95.9%
add-sqr-sqrt-0.0%
sqrt-unprod75.8%
sqr-neg75.8%
sqrt-prod75.8%
add-sqr-sqrt75.8%
div-inv75.8%
Applied egg-rr75.8%
associate-*r/75.8%
*-rgt-identity75.8%
Simplified75.8%
if 0.888000011 < (-.f32 #s(literal 1 binary32) u0) Initial program 56.6%
distribute-frac-neg56.6%
distribute-neg-frac256.6%
sub-neg56.6%
log1p-define98.4%
neg-sub098.4%
associate--r+98.4%
neg-sub098.4%
associate-/r*98.3%
distribute-neg-frac298.3%
Simplified98.3%
Taylor expanded in u0 around 0 97.5%
Final simplification94.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(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.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
neg-mul-161.4%
associate-/r*61.4%
metadata-eval61.4%
distribute-neg-frac261.4%
/-rgt-identity61.4%
sub-neg61.4%
log1p-define98.1%
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(log1p(Float32(-u0)) / Float32(Float32(Float32(cos2phi / alphax) / Float32(-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.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
associate-/r*98.0%
div-inv97.9%
Applied egg-rr97.9%
associate-*r/98.0%
*-rgt-identity98.0%
Simplified98.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(log1p(Float32(-u0)) / Float32(Float32(Float32(cos2phi / alphax) / Float32(-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.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (+ 0.5 (* u0 (- 0.3333333333333333 (* u0 -0.25))))))) (+ (/ sin2phi (* alphay alphay)) (/ (/ cos2phi alphax) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f + (u0 * (0.3333333333333333f - (u0 * -0.25f))))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 * (1.0e0 + (u0 * (0.5e0 + (u0 * (0.3333333333333333e0 - (u0 * (-0.25e0)))))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) + Float32(u0 * Float32(Float32(0.3333333333333333) - Float32(u0 * Float32(-0.25)))))))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(Float32(cos2phi / alphax) / alphax))) 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)))))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax)); 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{sin2phi}{alphay \cdot alphay} + \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
Taylor expanded in u0 around 0 91.7%
Final simplification91.7%
(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.4%
Taylor expanded in u0 around 0 91.6%
*-commutative91.6%
Simplified91.6%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (- 0.5 (* u0 -0.3333333333333333))))) (+ (/ (/ sin2phi alphay) alphay) (/ (/ cos2phi alphax) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f - (u0 * -0.3333333333333333f))))) / (((sin2phi / alphay) / alphay) + ((cos2phi / alphax) / alphax));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 * (1.0e0 + (u0 * (0.5e0 - (u0 * (-0.3333333333333333e0)))))) / (((sin2phi / alphay) / alphay) + ((cos2phi / alphax) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) - Float32(u0 * Float32(-0.3333333333333333)))))) / Float32(Float32(Float32(sin2phi / alphay) / alphay) + Float32(Float32(cos2phi / alphax) / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) - (u0 * single(-0.3333333333333333)))))) / (((sin2phi / alphay) / alphay) + ((cos2phi / alphax) / alphax)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 - u0 \cdot -0.3333333333333333\right)\right)}{\frac{\frac{sin2phi}{alphay}}{alphay} + \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
associate-/r*98.0%
div-inv97.9%
Applied egg-rr97.9%
associate-*r/98.0%
*-rgt-identity98.0%
Simplified98.0%
Taylor expanded in u0 around 0 90.3%
Final simplification90.3%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (+ 1.0 (* u0 (- 0.5 (* u0 -0.3333333333333333))))) (+ (/ sin2phi (* alphay alphay)) (/ (/ cos2phi alphax) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f + (u0 * (0.5f - (u0 * -0.3333333333333333f))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 * (1.0e0 + (u0 * (0.5e0 - (u0 * (-0.3333333333333333e0)))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) + Float32(u0 * Float32(Float32(0.5) - Float32(u0 * Float32(-0.3333333333333333)))))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(Float32(cos2phi / alphax) / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) + (u0 * (single(0.5) - (u0 * single(-0.3333333333333333)))))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 + u0 \cdot \left(0.5 - u0 \cdot -0.3333333333333333\right)\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
Taylor expanded in u0 around 0 90.3%
Final simplification90.3%
(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.4%
Taylor expanded in u0 around 0 90.2%
*-commutative90.2%
Simplified90.2%
(FPCore (alphax alphay u0 cos2phi sin2phi) :precision binary32 (/ (* u0 (- 1.0 (* u0 -0.5))) (+ (/ sin2phi (* alphay alphay)) (/ (/ cos2phi alphax) alphax))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
return (u0 * (1.0f - (u0 * -0.5f))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax));
}
real(4) function code(alphax, alphay, u0, cos2phi, sin2phi)
real(4), intent (in) :: alphax
real(4), intent (in) :: alphay
real(4), intent (in) :: u0
real(4), intent (in) :: cos2phi
real(4), intent (in) :: sin2phi
code = (u0 * (1.0e0 - (u0 * (-0.5e0)))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax))
end function
function code(alphax, alphay, u0, cos2phi, sin2phi) return Float32(Float32(u0 * Float32(Float32(1.0) - Float32(u0 * Float32(-0.5)))) / Float32(Float32(sin2phi / Float32(alphay * alphay)) + Float32(Float32(cos2phi / alphax) / alphax))) end
function tmp = code(alphax, alphay, u0, cos2phi, sin2phi) tmp = (u0 * (single(1.0) - (u0 * single(-0.5)))) / ((sin2phi / (alphay * alphay)) + ((cos2phi / alphax) / alphax)); end
\begin{array}{l}
\\
\frac{u0 \cdot \left(1 - u0 \cdot -0.5\right)}{\frac{sin2phi}{alphay \cdot alphay} + \frac{\frac{cos2phi}{alphax}}{alphax}}
\end{array}
Initial program 61.4%
distribute-frac-neg61.4%
distribute-neg-frac261.4%
sub-neg61.4%
log1p-define98.1%
neg-sub098.1%
associate--r+98.1%
neg-sub098.1%
associate-/r*98.0%
distribute-neg-frac298.0%
Simplified98.0%
Taylor expanded in u0 around 0 87.0%
Final simplification87.0%
(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.4%
Taylor expanded in u0 around 0 87.0%
*-commutative87.0%
Simplified87.0%
(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(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{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}
\end{array}
Initial program 61.4%
Taylor expanded in u0 around 0 75.4%
associate-/r*98.0%
div-inv97.9%
Applied egg-rr75.4%
associate-*r/98.0%
*-rgt-identity98.0%
Simplified75.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.4%
Taylor expanded in u0 around 0 75.4%
herbie shell --seed 2024191
(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)))))