
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))) (* (sin (* (* 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\\
\sin \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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (ux uy maxCos) :precision binary32 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))) (* (sin (* (* 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\\
\sin \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
(let* ((t_0 (- (/ 2.0 ux) 1.0)) (t_1 (sin (* (* uy 2.0) (PI)))))
(if (<= maxCos 4.99999991225835e-14)
(* t_1 (sqrt (* t_0 (* ux ux))))
(*
t_1
(sqrt
(*
(-
(*
(* ux ux)
(+ (/ (/ t_0 maxCos) maxCos) (/ (- 2.0 (/ 2.0 ux)) maxCos)))
(* ux ux))
(* maxCos maxCos)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{ux} - 1\\
t_1 := \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;maxCos \leq 4.99999991225835 \cdot 10^{-14}:\\
\;\;\;\;t\_1 \cdot \sqrt{t\_0 \cdot \left(ux \cdot ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{t\_0}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\
\end{array}
\end{array}
if maxCos < 4.99999991e-14Initial program 63.8%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3220.4
Applied rewrites23.4%
Applied rewrites98.2%
Taylor expanded in maxCos around 0
Applied rewrites98.2%
if 4.99999991e-14 < maxCos Initial program 55.3%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3218.9
Applied rewrites20.6%
Taylor expanded in maxCos around inf
Applied rewrites98.1%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* (* uy 2.0) (PI))) (sqrt (* (- (/ (- 2.0 (* 2.0 maxCos)) ux) (pow (- maxCos 1.0) 2.0)) (* ux ux)))))
\begin{array}{l}
\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}
\end{array}
Initial program 61.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3220.6
Applied rewrites21.2%
Applied rewrites98.2%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sin (* (* uy 2.0) (PI)))
(sqrt
(*
(- (/ (- (- 2.0 maxCos) maxCos) ux) (pow (- maxCos 1.0) 2.0))
(* ux ux)))))\begin{array}{l}
\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\left(2 - maxCos\right) - maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}
\end{array}
Initial program 61.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3220.9
Applied rewrites19.0%
Applied rewrites98.2%
Applied rewrites98.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- (/ 2.0 ux) 1.0)) (t_1 (sin (* (* uy 2.0) (PI)))))
(if (<= maxCos 2.8000000525086298e-14)
(* t_1 (sqrt (* t_0 (* ux ux))))
(*
t_1
(sqrt
(*
(fma
(- ux)
ux
(*
(* ux ux)
(+ (/ t_0 (* maxCos maxCos)) (/ (- 2.0 (/ 2.0 ux)) maxCos))))
(* maxCos maxCos)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{ux} - 1\\
t_1 := \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;maxCos \leq 2.8000000525086298 \cdot 10^{-14}:\\
\;\;\;\;t\_1 \cdot \sqrt{t\_0 \cdot \left(ux \cdot ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(-ux, ux, \left(ux \cdot ux\right) \cdot \left(\frac{t\_0}{maxCos \cdot maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right)\right) \cdot \left(maxCos \cdot maxCos\right)}\\
\end{array}
\end{array}
if maxCos < 2.80000005e-14Initial program 63.7%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3219.7
Applied rewrites19.5%
Applied rewrites98.2%
Taylor expanded in maxCos around 0
Applied rewrites98.2%
if 2.80000005e-14 < maxCos Initial program 55.7%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3219.2
Applied rewrites18.7%
Applied rewrites98.1%
Taylor expanded in maxCos around inf
Applied rewrites47.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9996500015258789)
(*
(sin (* (* uy 2.0) (PI)))
(sqrt (- 1.0 (* (- (- ux (* maxCos ux)) 1.0) (- ux 1.0)))))
(*
(* (sqrt 2.0) (sin (* (* (PI) uy) 2.0)))
(sqrt (- ux (* ux maxCos)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9996500015258789:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(ux - maxCos \cdot ux\right) - 1\right) \cdot \left(ux - 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{2} \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{ux - ux \cdot maxCos}\\
\end{array}
\end{array}
if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.99965Initial program 90.5%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3290.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3290.6
Applied rewrites90.6%
Taylor expanded in maxCos around 0
lower--.f3287.0
Applied rewrites87.0%
if 0.99965 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 40.6%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3240.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3240.6
Applied rewrites40.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sqrt.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-sqrt.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3290.5
Applied rewrites90.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (sin (* (* uy 2.0) (PI)))))
(if (<= (* t_0 t_0) 0.9996500015258789)
(* t_1 (sqrt (- 1.0 (* (- (- ux (* maxCos ux)) 1.0) (- ux 1.0)))))
(* t_1 (sqrt (* (- ux (* ux maxCos)) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9996500015258789:\\
\;\;\;\;t\_1 \cdot \sqrt{1 - \left(\left(ux - maxCos \cdot ux\right) - 1\right) \cdot \left(ux - 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(ux - ux \cdot maxCos\right) \cdot 2}\\
\end{array}
\end{array}
if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.99965Initial program 90.5%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3290.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3290.6
Applied rewrites90.6%
Taylor expanded in maxCos around 0
lower--.f3287.0
Applied rewrites87.0%
if 0.99965 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 40.6%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3240.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3240.6
Applied rewrites40.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3290.2
Applied rewrites90.2%
Final simplification88.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (sin (* (* uy 2.0) (PI)))))
(if (<= (* t_0 t_0) 0.9996500015258789)
(* t_1 (sqrt (- 1.0 (* t_0 (- 1.0 ux)))))
(* t_1 (sqrt (* (- ux (* ux maxCos)) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9996500015258789:\\
\;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(ux - ux \cdot maxCos\right) \cdot 2}\\
\end{array}
\end{array}
if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.99965Initial program 90.5%
Taylor expanded in maxCos around 0
lower--.f3287.0
Applied rewrites87.0%
if 0.99965 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 40.6%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3240.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3240.6
Applied rewrites40.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3290.2
Applied rewrites90.2%
Final simplification88.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9980000257492065)
(*
(* (* (PI) 2.0) uy)
(sqrt (- 1.0 (* (- 1.0 (- ux (* maxCos ux))) t_0))))
(* (sin (* (* uy 2.0) (PI))) (sqrt (* (- ux (* ux maxCos)) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9980000257492065:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux - ux \cdot maxCos\right) \cdot 2}\\
\end{array}
\end{array}
if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.998000026Initial program 92.8%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.6
Applied rewrites77.6%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3277.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3277.6
Applied rewrites77.6%
if 0.998000026 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 43.8%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3243.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3243.8
Applied rewrites43.8%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3288.1
Applied rewrites88.1%
Final simplification84.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9993500113487244)
(*
(* (* (PI) 2.0) uy)
(sqrt (- 1.0 (* (- 1.0 (- ux (* maxCos ux))) t_0))))
(* (sin (* (* uy 2.0) (PI))) (sqrt (* (fma -2.0 maxCos 2.0) ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9993500113487244:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\end{array}
\end{array}
if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.999350011Initial program 91.3%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3276.3
Applied rewrites76.3%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3276.4
lift-*.f32N/A
*-commutativeN/A
lower-*.f3276.4
Applied rewrites76.4%
if 0.999350011 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 41.7%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3220.5
Applied rewrites20.5%
Taylor expanded in ux around 0
Applied rewrites38.9%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* (* uy 2.0) (PI))) (sqrt (* (- (/ 2.0 ux) 1.0) (* ux ux)))))
\begin{array}{l}
\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2}{ux} - 1\right) \cdot \left(ux \cdot ux\right)}
\end{array}
Initial program 61.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3220.4
Applied rewrites22.0%
Applied rewrites98.2%
Taylor expanded in maxCos around 0
Applied rewrites93.2%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* (* uy 2.0) (PI))) (sqrt (* (* (- (/ 2.0 ux) 1.0) ux) ux))))
\begin{array}{l}
\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot ux}
\end{array}
Initial program 61.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3219.3
Applied rewrites20.1%
Taylor expanded in maxCos around 0
Applied rewrites93.2%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= maxCos 6.000000233523199e-16)
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(- (/ 2.0 ux) (fma (/ maxCos ux) 2.0 (* (- maxCos 1.0) (- maxCos 1.0))))
(* ux ux))))
(*
(* (* (PI) uy) 2.0)
(sqrt
(*
(*
(-
(- (/ 2.0 maxCos) (/ -2.0 (* (* maxCos maxCos) ux)))
(+ (+ 1.0 (/ 1.0 (* maxCos maxCos))) (/ (/ 2.0 maxCos) ux)))
(* maxCos maxCos))
(* ux ux))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 6.000000233523199 \cdot 10^{-16}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\frac{2}{ux} - \mathsf{fma}\left(\frac{maxCos}{ux}, 2, \left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right) \cdot \left(ux \cdot ux\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\left(\left(\left(\frac{2}{maxCos} - \frac{-2}{\left(maxCos \cdot maxCos\right) \cdot ux}\right) - \left(\left(1 + \frac{1}{maxCos \cdot maxCos}\right) + \frac{\frac{2}{maxCos}}{ux}\right)\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux \cdot ux\right)}\\
\end{array}
\end{array}
if maxCos < 6.0000002e-16Initial program 63.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3254.1
Applied rewrites54.1%
*-lft-identityN/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
distribute-lft-inN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
Applied rewrites19.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites80.0%
if 6.0000002e-16 < maxCos Initial program 57.2%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3222.1
Applied rewrites21.2%
Applied rewrites98.1%
Taylor expanded in maxCos around inf
Applied rewrites97.8%
Taylor expanded in uy around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3282.0
Applied rewrites82.0%
Final simplification81.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- ux (* ux maxCos))) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.03500000014901161)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt t_0))
(* (* (* (PI) 2.0) uy) (sqrt (- 1.0 (* (- 1.0 t_0) (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := ux - ux \cdot maxCos\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.03500000014901161:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - t\_0\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) < 0.0350000001Initial program 42.3%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3242.4
lift-*.f32N/A
*-commutativeN/A
lower-*.f3242.4
Applied rewrites42.4%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sqrt.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-sqrt.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3289.5
Applied rewrites89.5%
Taylor expanded in uy around 0
Applied rewrites76.2%
if 0.0350000001 < (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) Initial program 91.7%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3276.4
Applied rewrites76.4%
Taylor expanded in maxCos around 0
lower--.f3274.6
Applied rewrites74.6%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift--.f32N/A
lower--.f3274.6
lift-*.f32N/A
*-commutativeN/A
lift-*.f3274.6
Applied rewrites74.6%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.01860000006854534)
(* (* (+ (PI) (PI)) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(*
(* (* (PI) 2.0) uy)
(sqrt (- 1.0 (* (- 1.0 (- ux (* ux maxCos))) (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \leq 0.01860000006854534:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) < 0.0186000001Initial program 40.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3237.3
Applied rewrites37.3%
Taylor expanded in maxCos around 0
lower--.f3236.7
Applied rewrites36.7%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3274.1
Applied rewrites73.7%
Applied rewrites63.3%
if 0.0186000001 < (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) Initial program 90.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.8
Applied rewrites74.8%
Taylor expanded in maxCos around 0
lower--.f3272.9
Applied rewrites72.9%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift--.f32N/A
lower--.f3272.9
lift-*.f32N/A
*-commutativeN/A
lift-*.f3272.9
Applied rewrites72.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.01860000006854534)
(* (* (+ (PI) (PI)) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* (* (* (PI) 2.0) uy) (sqrt (- 1.0 (* t_0 (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \leq 0.01860000006854534:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) < 0.0186000001Initial program 40.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3237.3
Applied rewrites37.3%
Taylor expanded in maxCos around 0
lower--.f3236.7
Applied rewrites36.7%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3274.1
Applied rewrites73.7%
Applied rewrites74.1%
if 0.0186000001 < (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) Initial program 90.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.8
Applied rewrites74.8%
Taylor expanded in maxCos around 0
lower--.f3272.9
Applied rewrites72.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.01860000006854534)
(* (* (+ (PI) (PI)) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* (* (* (PI) 2.0) uy) (sqrt (- 1.0 (* (- 1.0 ux) (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \leq 0.01860000006854534:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) < 0.0186000001Initial program 40.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3237.3
Applied rewrites37.3%
Taylor expanded in maxCos around 0
lower--.f3236.7
Applied rewrites36.7%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3274.1
Applied rewrites73.7%
Applied rewrites63.3%
if 0.0186000001 < (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))) Initial program 90.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.8
Applied rewrites74.8%
Taylor expanded in maxCos around 0
lower--.f3272.9
Applied rewrites72.9%
Taylor expanded in maxCos around 0
lower--.f3272.7
Applied rewrites72.7%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0035000001080334187)
(*
t_0
(sqrt
(*
(-
(/ 2.0 ux)
(fma (/ maxCos ux) 2.0 (* (- maxCos 1.0) (- maxCos 1.0))))
(* ux ux))))
(*
t_0
(sqrt
(-
1.0
(* (- 1.0 (- ux (* maxCos ux))) (+ (- 1.0 ux) (* ux maxCos)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0035000001080334187:\\
\;\;\;\;t\_0 \cdot \sqrt{\left(\frac{2}{ux} - \mathsf{fma}\left(\frac{maxCos}{ux}, 2, \left(maxCos - 1\right) \cdot \left(maxCos - 1\right)\right)\right) \cdot \left(ux \cdot ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\\
\end{array}
\end{array}
if ux < 0.00350000011Initial program 47.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3242.0
Applied rewrites42.0%
*-lft-identityN/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
distribute-lft-inN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
Applied rewrites17.2%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites77.4%
if 0.00350000011 < ux Initial program 94.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3279.6
Applied rewrites79.6%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3279.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3279.7
Applied rewrites79.7%
Final simplification78.1%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= ux 0.00011999999696854502)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt (- ux (* ux maxCos))))
(*
(* (* (PI) 2.0) uy)
(sqrt
(- 1.0 (* (- 1.0 (- ux (* maxCos ux))) (+ (- 1.0 ux) (* ux maxCos))))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.00011999999696854502:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{ux - ux \cdot maxCos}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\\
\end{array}
\end{array}
if ux < 1.19999997e-4Initial program 39.2%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3239.2
lift-*.f32N/A
*-commutativeN/A
lower-*.f3239.2
Applied rewrites39.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sqrt.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-sqrt.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3291.2
Applied rewrites91.2%
Taylor expanded in uy around 0
Applied rewrites78.1%
if 1.19999997e-4 < ux Initial program 89.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.2
Applied rewrites74.2%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3274.2
lift-*.f32N/A
*-commutativeN/A
lower-*.f3274.2
Applied rewrites74.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= ux 0.00011999999696854502)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt (- ux (* ux maxCos))))
(* (* (* (PI) 2.0) uy) (sqrt (- 1.0 (* t_0 t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;ux \leq 0.00011999999696854502:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{ux - ux \cdot maxCos}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\\
\end{array}
\end{array}
if ux < 1.19999997e-4Initial program 39.2%
lift-*.f32N/A
sqr-abs-revN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
fabs-subN/A
sqr-absN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3239.2
lift-*.f32N/A
*-commutativeN/A
lower-*.f3239.2
Applied rewrites39.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sqrt.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-sqrt.f32N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3291.2
Applied rewrites91.2%
Taylor expanded in uy around 0
Applied rewrites78.1%
if 1.19999997e-4 < ux Initial program 89.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.2
Applied rewrites74.2%
(FPCore (ux uy maxCos) :precision binary32 (* (* (+ (PI) (PI)) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux))))
\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
\end{array}
Initial program 61.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3252.7
Applied rewrites52.7%
Taylor expanded in maxCos around 0
lower--.f3251.6
Applied rewrites51.6%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3262.1
Applied rewrites62.0%
Applied rewrites62.1%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* (PI) 2.0) uy) (sqrt (- 1.0 1.0))))
\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{1 - 1}
\end{array}
Initial program 61.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3252.7
Applied rewrites52.7%
*-lft-identityN/A
lift-*.f32N/A
lift-+.f32N/A
distribute-rgt-inN/A
distribute-lft-inN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
Applied rewrites20.0%
lift-fma.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-lft-identityN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lift-fma.f32N/A
lift-*.f32N/A
lift--.f32N/A
associate-+r-N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-lft-identity51.4
lift-*.f32N/A
*-commutativeN/A
lift-fma.f32N/A
Applied rewrites49.9%
Taylor expanded in ux around 0
Applied rewrites7.1%
herbie shell --seed 2024337
(FPCore (ux uy maxCos)
:name "UniformSampleCone, y"
: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)))
(* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))