
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))) (* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (1.0f - ux) + (ux * maxCos);
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(1.0) - ux) + (ux * maxCos); tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0))); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))) (* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
float t_0 = (1.0f - ux) + (ux * maxCos);
return cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos) t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) return Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))) end
function tmp = code(ux, uy, maxCos) t_0 = (single(1.0) - ux) + (ux * maxCos); tmp = cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0))); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* PI (* uy 2.0))) (sqrt (+ (* maxCos (* ux (- (* ux (- 2.0 maxCos)) 2.0))) (* ux (- 2.0 ux))))))
float code(float ux, float uy, float maxCos) {
return cosf((((float) M_PI) * (uy * 2.0f))) * sqrtf(((maxCos * (ux * ((ux * (2.0f - maxCos)) - 2.0f))) + (ux * (2.0f - ux))));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(Float32(maxCos * Float32(ux * Float32(Float32(ux * Float32(Float32(2.0) - maxCos)) - Float32(2.0)))) + Float32(ux * Float32(Float32(2.0) - ux))))) end
function tmp = code(ux, uy, maxCos) tmp = cos((single(pi) * (uy * single(2.0)))) * sqrt(((maxCos * (ux * ((ux * (single(2.0) - maxCos)) - single(2.0)))) + (ux * (single(2.0) - ux)))); end
\begin{array}{l}
\\
\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{maxCos \cdot \left(ux \cdot \left(ux \cdot \left(2 - maxCos\right) - 2\right)\right) + ux \cdot \left(2 - ux\right)}
\end{array}
Initial program 59.5%
Taylor expanded in ux around 0 62.3%
Taylor expanded in maxCos around 0 99.3%
Taylor expanded in ux around 0 99.3%
Taylor expanded in maxCos around 0 99.2%
mul-1-neg99.2%
distribute-lft-neg-out99.2%
+-commutative99.2%
distribute-rgt-in99.3%
sub-neg99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (ux uy maxCos)
:precision binary32
(*
ux
(*
(cos (* PI (* uy 2.0)))
(sqrt
(-
(* (- 1.0 maxCos) (+ maxCos -1.0))
(/ (+ maxCos (+ maxCos -2.0)) ux))))))
float code(float ux, float uy, float maxCos) {
return ux * (cosf((((float) M_PI) * (uy * 2.0f))) * sqrtf((((1.0f - maxCos) * (maxCos + -1.0f)) - ((maxCos + (maxCos + -2.0f)) / ux))));
}
function code(ux, uy, maxCos) return Float32(ux * Float32(cos(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) - Float32(Float32(maxCos + Float32(maxCos + Float32(-2.0))) / ux))))) end
function tmp = code(ux, uy, maxCos) tmp = ux * (cos((single(pi) * (uy * single(2.0)))) * sqrt((((single(1.0) - maxCos) * (maxCos + single(-1.0))) - ((maxCos + (maxCos + single(-2.0))) / ux)))); end
\begin{array}{l}
\\
ux \cdot \left(\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) - \frac{maxCos + \left(maxCos + -2\right)}{ux}}\right)
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in ux around inf 98.9%
Taylor expanded in ux around -inf 98.9%
Taylor expanded in uy around inf 98.8%
associate-*l*98.6%
associate-*r*98.6%
+-commutative98.6%
mul-1-neg98.6%
unsub-neg98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* PI (* uy 2.0))) (sqrt (+ (* maxCos (* ux (- (* 2.0 ux) 2.0))) (* ux (- 2.0 ux))))))
float code(float ux, float uy, float maxCos) {
return cosf((((float) M_PI) * (uy * 2.0f))) * sqrtf(((maxCos * (ux * ((2.0f * ux) - 2.0f))) + (ux * (2.0f - ux))));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(Float32(maxCos * Float32(ux * Float32(Float32(Float32(2.0) * ux) - Float32(2.0)))) + Float32(ux * Float32(Float32(2.0) - ux))))) end
function tmp = code(ux, uy, maxCos) tmp = cos((single(pi) * (uy * single(2.0)))) * sqrt(((maxCos * (ux * ((single(2.0) * ux) - single(2.0)))) + (ux * (single(2.0) - ux)))); end
\begin{array}{l}
\\
\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\right) + ux \cdot \left(2 - ux\right)}
\end{array}
Initial program 59.5%
Taylor expanded in ux around 0 62.3%
Taylor expanded in maxCos around 0 99.3%
Taylor expanded in ux around 0 99.3%
Taylor expanded in maxCos around 0 97.7%
Final simplification97.7%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* PI (* uy 2.0))) (sqrt (+ (* ux (* maxCos -2.0)) (* ux (- 2.0 ux))))))
float code(float ux, float uy, float maxCos) {
return cosf((((float) M_PI) * (uy * 2.0f))) * sqrtf(((ux * (maxCos * -2.0f)) + (ux * (2.0f - ux))));
}
function code(ux, uy, maxCos) return Float32(cos(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(Float32(ux * Float32(maxCos * Float32(-2.0))) + Float32(ux * Float32(Float32(2.0) - ux))))) end
function tmp = code(ux, uy, maxCos) tmp = cos((single(pi) * (uy * single(2.0)))) * sqrt(((ux * (maxCos * single(-2.0))) + (ux * (single(2.0) - ux)))); end
\begin{array}{l}
\\
\cos \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(maxCos \cdot -2\right) + ux \cdot \left(2 - ux\right)}
\end{array}
Initial program 59.5%
Taylor expanded in ux around 0 62.3%
Taylor expanded in maxCos around 0 99.3%
Taylor expanded in ux around 0 96.8%
associate-*r*96.8%
*-commutative96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= maxCos 9.999999747378752e-6)
(* (cos (* uy (* 2.0 PI))) (sqrt (* ux (- 2.0 ux))))
(*
ux
(sqrt
(-
(-
(+ (* (- 1.0 maxCos) (+ maxCos -1.0)) (/ 1.0 ux))
(/ (+ maxCos -1.0) ux))
(/ maxCos ux))))))
float code(float ux, float uy, float maxCos) {
float tmp;
if (maxCos <= 9.999999747378752e-6f) {
tmp = cosf((uy * (2.0f * ((float) M_PI)))) * sqrtf((ux * (2.0f - ux)));
} else {
tmp = ux * sqrtf((((((1.0f - maxCos) * (maxCos + -1.0f)) + (1.0f / ux)) - ((maxCos + -1.0f) / ux)) - (maxCos / ux)));
}
return tmp;
}
function code(ux, uy, maxCos) tmp = Float32(0.0) if (maxCos <= Float32(9.999999747378752e-6)) tmp = Float32(cos(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux)))); else tmp = Float32(ux * sqrt(Float32(Float32(Float32(Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0))) + Float32(Float32(1.0) / ux)) - Float32(Float32(maxCos + Float32(-1.0)) / ux)) - Float32(maxCos / ux)))); end return tmp end
function tmp_2 = code(ux, uy, maxCos) tmp = single(0.0); if (maxCos <= single(9.999999747378752e-6)) tmp = cos((uy * (single(2.0) * single(pi)))) * sqrt((ux * (single(2.0) - ux))); else tmp = ux * sqrt((((((single(1.0) - maxCos) * (maxCos + single(-1.0))) + (single(1.0) / ux)) - ((maxCos + single(-1.0)) / ux)) - (maxCos / ux))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 9.999999747378752 \cdot 10^{-6}:\\
\;\;\;\;\cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\
\mathbf{else}:\\
\;\;\;\;ux \cdot \sqrt{\left(\left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right) + \frac{1}{ux}\right) - \frac{maxCos + -1}{ux}\right) - \frac{maxCos}{ux}}\\
\end{array}
\end{array}
if maxCos < 9.99999975e-6Initial program 58.7%
associate-*l*58.7%
sub-neg58.7%
+-commutative58.7%
distribute-rgt-neg-in58.7%
fma-define58.7%
Simplified58.7%
Taylor expanded in ux around 0 99.2%
Taylor expanded in maxCos around 0 98.7%
neg-mul-198.7%
unsub-neg98.7%
Simplified98.7%
if 9.99999975e-6 < maxCos Initial program 65.8%
associate-*l*65.8%
sub-neg65.8%
+-commutative65.8%
distribute-rgt-neg-in65.8%
fma-define65.7%
Simplified66.8%
Taylor expanded in ux around inf 99.0%
Taylor expanded in uy around 0 83.5%
Final simplification96.9%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* ux (+ 2.0 (- (- (* maxCos (* ux (- 2.0 maxCos))) ux) (* 2.0 maxCos))))))
float code(float ux, float uy, float maxCos) {
return sqrtf((ux * (2.0f + (((maxCos * (ux * (2.0f - maxCos))) - ux) - (2.0f * maxCos)))));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((ux * (2.0e0 + (((maxcos * (ux * (2.0e0 - maxcos))) - ux) - (2.0e0 * maxcos)))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(ux * Float32(Float32(2.0) + Float32(Float32(Float32(maxCos * Float32(ux * Float32(Float32(2.0) - maxCos))) - ux) - Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((ux * (single(2.0) + (((maxCos * (ux * (single(2.0) - maxCos))) - ux) - (single(2.0) * maxCos))))); end
\begin{array}{l}
\\
\sqrt{ux \cdot \left(2 + \left(\left(maxCos \cdot \left(ux \cdot \left(2 - maxCos\right)\right) - ux\right) - 2 \cdot maxCos\right)\right)}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 80.7%
associate--l+80.7%
associate-*r*80.7%
neg-mul-180.7%
sub-neg80.7%
metadata-eval80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in maxCos around 0 80.7%
neg-mul-180.7%
+-commutative80.7%
+-commutative80.7%
associate-*r*80.7%
neg-mul-180.7%
distribute-rgt-in80.7%
neg-mul-180.7%
unsub-neg80.7%
neg-mul-180.7%
unsub-neg80.7%
Simplified80.7%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (+ (* maxCos (* ux (- (* 2.0 ux) 2.0))) (* ux (- 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
return sqrtf(((maxCos * (ux * ((2.0f * ux) - 2.0f))) + (ux * (2.0f - ux))));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt(((maxcos * (ux * ((2.0e0 * ux) - 2.0e0))) + (ux * (2.0e0 - ux))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(maxCos * Float32(ux * Float32(Float32(Float32(2.0) * ux) - Float32(2.0)))) + Float32(ux * Float32(Float32(2.0) - ux)))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt(((maxCos * (ux * ((single(2.0) * ux) - single(2.0)))) + (ux * (single(2.0) - ux)))); end
\begin{array}{l}
\\
\sqrt{maxCos \cdot \left(ux \cdot \left(2 \cdot ux - 2\right)\right) + ux \cdot \left(2 - ux\right)}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 80.7%
associate--l+80.7%
associate-*r*80.7%
neg-mul-180.7%
sub-neg80.7%
metadata-eval80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in maxCos around 0 79.4%
distribute-lft-in79.4%
mul-1-neg79.4%
Applied egg-rr79.4%
distribute-lft-in79.4%
unsub-neg79.4%
Simplified79.4%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* ux (+ 2.0 (- (- (* 2.0 (* maxCos ux)) ux) (* 2.0 maxCos))))))
float code(float ux, float uy, float maxCos) {
return sqrtf((ux * (2.0f + (((2.0f * (maxCos * ux)) - ux) - (2.0f * maxCos)))));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((ux * (2.0e0 + (((2.0e0 * (maxcos * ux)) - ux) - (2.0e0 * maxcos)))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(ux * Float32(Float32(2.0) + Float32(Float32(Float32(Float32(2.0) * Float32(maxCos * ux)) - ux) - Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((ux * (single(2.0) + (((single(2.0) * (maxCos * ux)) - ux) - (single(2.0) * maxCos))))); end
\begin{array}{l}
\\
\sqrt{ux \cdot \left(2 + \left(\left(2 \cdot \left(maxCos \cdot ux\right) - ux\right) - 2 \cdot maxCos\right)\right)}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 80.7%
associate--l+80.7%
associate-*r*80.7%
neg-mul-180.7%
sub-neg80.7%
metadata-eval80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in maxCos around 0 79.4%
neg-mul-179.4%
+-commutative79.4%
unsub-neg79.4%
Simplified79.4%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* ux (- 2.0 (+ ux (* 2.0 maxCos))))))
float code(float ux, float uy, float maxCos) {
return sqrtf((ux * (2.0f - (ux + (2.0f * maxCos)))));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((ux * (2.0e0 - (ux + (2.0e0 * maxcos)))))
end function
function code(ux, uy, maxCos) return sqrt(Float32(ux * Float32(Float32(2.0) - Float32(ux + Float32(Float32(2.0) * maxCos))))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((ux * (single(2.0) - (ux + (single(2.0) * maxCos))))); end
\begin{array}{l}
\\
\sqrt{ux \cdot \left(2 - \left(ux + 2 \cdot maxCos\right)\right)}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 80.7%
associate--l+80.7%
associate-*r*80.7%
neg-mul-180.7%
sub-neg80.7%
metadata-eval80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in maxCos around 0 78.6%
Final simplification78.6%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* ux (- 2.0 ux))))
float code(float ux, float uy, float maxCos) {
return sqrtf((ux * (2.0f - ux)));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((ux * (2.0e0 - ux)))
end function
function code(ux, uy, maxCos) return sqrt(Float32(ux * Float32(Float32(2.0) - ux))) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((ux * (single(2.0) - ux))); end
\begin{array}{l}
\\
\sqrt{ux \cdot \left(2 - ux\right)}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 80.7%
associate--l+80.7%
associate-*r*80.7%
neg-mul-180.7%
sub-neg80.7%
metadata-eval80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in maxCos around 0 76.3%
neg-mul-176.3%
unsub-neg76.3%
Simplified76.3%
(FPCore (ux uy maxCos) :precision binary32 (sqrt (* 2.0 ux)))
float code(float ux, float uy, float maxCos) {
return sqrtf((2.0f * ux));
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((2.0e0 * ux))
end function
function code(ux, uy, maxCos) return sqrt(Float32(Float32(2.0) * ux)) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((single(2.0) * ux)); end
\begin{array}{l}
\\
\sqrt{2 \cdot ux}
\end{array}
Initial program 59.5%
associate-*l*59.5%
sub-neg59.5%
+-commutative59.5%
distribute-rgt-neg-in59.5%
fma-define59.6%
Simplified59.7%
Taylor expanded in uy around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
sub-neg51.8%
metadata-eval51.8%
distribute-lft-in51.8%
*-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
*-commutative51.8%
associate--l+51.7%
unpow251.7%
sub-neg51.7%
Simplified51.9%
Taylor expanded in ux around 0 64.0%
Taylor expanded in maxCos around 0 62.0%
*-commutative62.0%
Simplified62.0%
Final simplification62.0%
herbie shell --seed 2024145
(FPCore (ux uy maxCos)
:name "UniformSampleCone, x"
:precision binary32
:pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0)) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
(* (cos (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))