
(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))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 12 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))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- 2.0 (- (* (pow (- maxCos 1.0) 2.0) ux) (* -2.0 maxCos))) ux)) (cos (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(2 - \left({\left(maxCos - 1\right)}^{2} \cdot ux - -2 \cdot maxCos\right)\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 54.8%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites40.5%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites3.0%
Applied rewrites98.7%
Final simplification98.7%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.0001500000071246177)
(*
1.0
(sqrt (* (- 2.0 (- (* (pow (- maxCos 1.0) 2.0) ux) (* -2.0 maxCos))) ux)))
(* (sqrt (+ (* (- 1.0 ux) ux) ux)) (cos (* (PI) (* 2.0 uy))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.0001500000071246177:\\
\;\;\;\;1 \cdot \sqrt{\left(2 - \left({\left(maxCos - 1\right)}^{2} \cdot ux - -2 \cdot maxCos\right)\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(1 - ux\right) \cdot ux + ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 1.50000007e-4Initial program 55.8%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites54.3%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites2.2%
Applied rewrites99.4%
Taylor expanded in uy around 0
Applied rewrites99.3%
if 1.50000007e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 53.6%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites23.8%
Taylor expanded in maxCos around 0
associate-*r*N/A
mul-1-negN/A
cancel-sign-subN/A
lower-+.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3293.2
Applied rewrites93.2%
Final simplification96.5%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- (- 2.0 (* (+ (* -2.0 ux) 2.0) maxCos)) ux) ux)) (cos (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(\left(2 - \left(-2 \cdot ux + 2\right) \cdot maxCos\right) - ux\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 54.8%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites40.5%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites2.6%
Taylor expanded in maxCos around 0
Applied rewrites91.0%
Applied rewrites98.5%
Final simplification98.5%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.0001500000071246177)
(*
(sqrt
(-
(* (- (/ 2.0 ux) (- (/ maxCos ux) (- maxCos 1.0))) (* ux ux))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
1.0)
(* (sqrt (+ (* (- 1.0 ux) ux) ux)) (cos (* (PI) (* 2.0 uy))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.0001500000071246177:\\
\;\;\;\;\sqrt{\left(\frac{2}{ux} - \left(\frac{maxCos}{ux} - \left(maxCos - 1\right)\right)\right) \cdot \left(ux \cdot ux\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(1 - ux\right) \cdot ux + ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 1.50000007e-4Initial program 55.8%
Taylor expanded in uy around 0
Applied rewrites55.8%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
associate--r+N/A
lower--.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites29.0%
lift-fma.f32N/A
lift-*.f32N/A
+-commutativeN/A
lift--.f32N/A
associate--r-N/A
lift--.f32N/A
lift--.f3253.9
lift-*.f32N/A
*-commutativeN/A
lift-*.f3252.8
Applied rewrites52.6%
Taylor expanded in ux around inf
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower--.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower--.f3298.7
Applied rewrites98.7%
if 1.50000007e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 53.6%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites23.8%
Taylor expanded in maxCos around 0
associate-*r*N/A
mul-1-negN/A
cancel-sign-subN/A
lower-+.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3293.2
Applied rewrites93.2%
Final simplification93.8%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.0001500000071246177)
(*
(sqrt
(-
(* (- (/ 2.0 ux) (- (/ maxCos ux) (- maxCos 1.0))) (* ux ux))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
1.0)
(* (sqrt (* (- 2.0 ux) ux)) (cos (* (PI) (* 2.0 uy))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.0001500000071246177:\\
\;\;\;\;\sqrt{\left(\frac{2}{ux} - \left(\frac{maxCos}{ux} - \left(maxCos - 1\right)\right)\right) \cdot \left(ux \cdot ux\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 1.50000007e-4Initial program 55.8%
Taylor expanded in uy around 0
Applied rewrites55.8%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
associate--r+N/A
lower--.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites29.7%
lift-fma.f32N/A
lift-*.f32N/A
+-commutativeN/A
lift--.f32N/A
associate--r-N/A
lift--.f32N/A
lift--.f3253.3
lift-*.f32N/A
*-commutativeN/A
lift-*.f3252.8
Applied rewrites53.4%
Taylor expanded in ux around inf
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower--.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower--.f3298.7
Applied rewrites98.7%
if 1.50000007e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 53.6%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites23.8%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites1.4%
Taylor expanded in maxCos around 0
Applied rewrites93.1%
Final simplification93.9%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- (- 2.0 (* 2.0 maxCos)) ux) ux)) (cos (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(\left(2 - 2 \cdot maxCos\right) - ux\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 54.8%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites40.8%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites3.4%
Taylor expanded in maxCos around 0
Applied rewrites91.0%
Taylor expanded in ux around 0
Applied rewrites97.7%
Final simplification97.7%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sqrt
(-
(* (- (/ 2.0 ux) (- (/ maxCos ux) (- maxCos 1.0))) (* ux ux))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf(((((2.0f / ux) - ((maxCos / ux) - (maxCos - 1.0f))) * (ux * ux)) - ((fmaf(maxCos, ux, (1.0f - ux)) * maxCos) * ux))) * 1.0f;
}
function code(ux, uy, maxCos) return Float32(sqrt(Float32(Float32(Float32(Float32(Float32(2.0) / ux) - Float32(Float32(maxCos / ux) - Float32(maxCos - Float32(1.0)))) * Float32(ux * ux)) - Float32(Float32(fma(maxCos, ux, Float32(Float32(1.0) - ux)) * maxCos) * ux))) * Float32(1.0)) end
\begin{array}{l}
\\
\sqrt{\left(\frac{2}{ux} - \left(\frac{maxCos}{ux} - \left(maxCos - 1\right)\right)\right) \cdot \left(ux \cdot ux\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot 1
\end{array}
Initial program 54.8%
Taylor expanded in uy around 0
Applied rewrites46.4%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
associate--r+N/A
lower--.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites26.2%
lift-fma.f32N/A
lift-*.f32N/A
+-commutativeN/A
lift--.f32N/A
associate--r-N/A
lift--.f32N/A
lift--.f3244.7
lift-*.f32N/A
*-commutativeN/A
lift-*.f3244.6
Applied rewrites44.1%
Taylor expanded in ux around inf
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower--.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower--.f3277.7
Applied rewrites77.7%
Final simplification77.7%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sqrt
(-
(* (- (/ (- 2.0 maxCos) ux) (- 1.0 maxCos)) (* ux ux))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf((((((2.0f - maxCos) / ux) - (1.0f - maxCos)) * (ux * ux)) - ((fmaf(maxCos, ux, (1.0f - ux)) * maxCos) * ux))) * 1.0f;
}
function code(ux, uy, maxCos) return Float32(sqrt(Float32(Float32(Float32(Float32(Float32(Float32(2.0) - maxCos) / ux) - Float32(Float32(1.0) - maxCos)) * Float32(ux * ux)) - Float32(Float32(fma(maxCos, ux, Float32(Float32(1.0) - ux)) * maxCos) * ux))) * Float32(1.0)) end
\begin{array}{l}
\\
\sqrt{\left(\frac{2 - maxCos}{ux} - \left(1 - maxCos\right)\right) \cdot \left(ux \cdot ux\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot 1
\end{array}
Initial program 54.8%
Taylor expanded in uy around 0
Applied rewrites46.4%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
associate--r+N/A
lower--.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites26.6%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites77.6%
Final simplification77.6%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- (- 2.0 (* (fma -2.0 ux 2.0) maxCos)) ux) ux)) 1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf((((2.0f - (fmaf(-2.0f, ux, 2.0f) * maxCos)) - ux) * ux)) * 1.0f;
}
function code(ux, uy, maxCos) return Float32(sqrt(Float32(Float32(Float32(Float32(2.0) - Float32(fma(Float32(-2.0), ux, Float32(2.0)) * maxCos)) - ux) * ux)) * Float32(1.0)) end
\begin{array}{l}
\\
\sqrt{\left(\left(2 - \mathsf{fma}\left(-2, ux, 2\right) \cdot maxCos\right) - ux\right) \cdot ux} \cdot 1
\end{array}
Initial program 54.8%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
Applied rewrites40.5%
Taylor expanded in ux around 0
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f32N/A
Applied rewrites1.9%
Taylor expanded in maxCos around 0
Applied rewrites91.0%
Taylor expanded in uy around 0
Applied rewrites77.3%
Final simplification77.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (fma -2.0 maxCos 2.0) ux)) 1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf((fmaf(-2.0f, maxCos, 2.0f) * ux)) * 1.0f;
}
function code(ux, uy, maxCos) return Float32(sqrt(Float32(fma(Float32(-2.0), maxCos, Float32(2.0)) * ux)) * Float32(1.0)) end
\begin{array}{l}
\\
\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot 1
\end{array}
Initial program 54.8%
Taylor expanded in uy around 0
Applied rewrites46.4%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3260.3
Applied rewrites60.3%
Final simplification60.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (fma -1.0 1.0 1.0)) 1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf(fmaf(-1.0f, 1.0f, 1.0f)) * 1.0f;
}
function code(ux, uy, maxCos) return Float32(sqrt(fma(Float32(-1.0), Float32(1.0), Float32(1.0))) * Float32(1.0)) end
\begin{array}{l}
\\
\sqrt{\mathsf{fma}\left(-1, 1, 1\right)} \cdot 1
\end{array}
Initial program 54.8%
Taylor expanded in uy around 0
Applied rewrites46.4%
Taylor expanded in ux around 0
Applied rewrites6.6%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
neg-mul-1N/A
lower-fma.f3219.2
Applied rewrites19.2%
Final simplification18.7%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (- 1.0 1.0)) 1.0))
float code(float ux, float uy, float maxCos) {
return sqrtf((1.0f - 1.0f)) * 1.0f;
}
real(4) function code(ux, uy, maxcos)
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = sqrt((1.0e0 - 1.0e0)) * 1.0e0
end function
function code(ux, uy, maxCos) return Float32(sqrt(Float32(Float32(1.0) - Float32(1.0))) * Float32(1.0)) end
function tmp = code(ux, uy, maxCos) tmp = sqrt((single(1.0) - single(1.0))) * single(1.0); end
\begin{array}{l}
\\
\sqrt{1 - 1} \cdot 1
\end{array}
Initial program 54.8%
Taylor expanded in uy around 0
Applied rewrites46.4%
Taylor expanded in ux around 0
Applied rewrites6.6%
Final simplification6.6%
herbie shell --seed 2024283
(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)))))))