
(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 19 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 (+ -1.0 (- ux (* maxCos ux)))))
(if (<= ux 8.600000001024455e-5)
(*
(* (pow (pow 2.0 0.25) 2.0) (sin (* (* (PI) uy) 2.0)))
(sqrt (* (- 1.0 maxCos) ux)))
(* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_0 t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \left(ux - maxCos \cdot ux\right)\\
\mathbf{if}\;ux \leq 8.600000001024455 \cdot 10^{-5}:\\
\;\;\;\;\left({\left({2}^{0.25}\right)}^{2} \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\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}
if ux < 8.6e-5Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Applied rewrites93.2%
if 8.6e-5 < ux Initial program 88.4%
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--.f3288.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3288.6
Applied rewrites88.6%
Final simplification91.3%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (+ -1.0 (- ux (* maxCos ux)))))
(if (<= (* t_0 t_0) 0.9998250007629395)
(* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_1 t_1))))
(*
(sqrt (- 1.0 maxCos))
(* (sqrt ux) (* (sqrt 2.0) (sin (* (* 2.0 uy) (PI)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := -1 + \left(ux - maxCos \cdot ux\right)\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9998250007629395:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - maxCos} \cdot \left(\sqrt{ux} \cdot \left(\sqrt{2} \cdot \sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\\
\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.999825001Initial program 88.4%
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--.f3288.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3288.6
Applied rewrites88.6%
if 0.999825001 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Applied rewrites93.1%
Final simplification91.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (+ -1.0 (- ux (* maxCos ux)))))
(if (<= (* t_0 t_0) 0.9998250007629395)
(* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_1 t_1))))
(*
(* (sqrt (* (- 1.0 maxCos) ux)) (sin (* (* 2.0 uy) (PI))))
(sqrt 2.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := -1 + \left(ux - maxCos \cdot ux\right)\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9998250007629395:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(1 - maxCos\right) \cdot ux} \cdot \sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{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.999825001Initial program 88.4%
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--.f3288.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3288.6
Applied rewrites88.6%
if 0.999825001 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Applied rewrites93.1%
Final simplification91.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (* t_0 t_0)))
(if (<= t_1 0.9998250007629395)
(* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 t_1)))
(*
(* (sqrt (* (- 1.0 maxCos) ux)) (sin (* (* 2.0 uy) (PI))))
(sqrt 2.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := t\_0 \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 0.9998250007629395:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(1 - maxCos\right) \cdot ux} \cdot \sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{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.999825001Initial program 88.4%
if 0.999825001 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Applied rewrites93.1%
Final simplification91.1%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9996200203895569)
(*
(sin (* (* uy 2.0) (PI)))
(sqrt (- 1.0 (* (- (- ux (* maxCos ux)) 1.0) (- ux 1.0)))))
(*
(* (sqrt (* (- 1.0 maxCos) ux)) (sin (* (* 2.0 uy) (PI))))
(sqrt 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.9996200203895569:\\
\;\;\;\;\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{\left(1 - maxCos\right) \cdot ux} \cdot \sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{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.99962002Initial program 89.7%
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--.f3289.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3289.8
Applied rewrites89.8%
Taylor expanded in maxCos around 0
lower--.f3287.3
Applied rewrites87.3%
if 0.99962002 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.9
Applied rewrites91.9%
Applied rewrites92.0%
Final simplification90.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9996200203895569)
(*
(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 (* (- 1.0 maxCos) 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.9996200203895569:\\
\;\;\;\;\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{\left(1 - maxCos\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.99962002Initial program 89.7%
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--.f3289.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3289.8
Applied rewrites89.8%
Taylor expanded in maxCos around 0
lower--.f3287.3
Applied rewrites87.3%
if 0.99962002 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.9
Applied rewrites91.9%
Final simplification90.2%
(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.9996200203895569)
(* t_1 (sqrt (- 1.0 (* (- (- ux (* maxCos ux)) 1.0) (- ux 1.0)))))
(* t_1 (sqrt (* ux (* 2.0 (- 1.0 maxCos))))))))\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.9996200203895569:\\
\;\;\;\;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{ux \cdot \left(2 \cdot \left(1 - maxCos\right)\right)}\\
\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.99962002Initial program 89.7%
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--.f3289.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3289.8
Applied rewrites89.8%
Taylor expanded in maxCos around 0
lower--.f3287.3
Applied rewrites87.3%
if 0.99962002 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
Taylor expanded in ux around 0
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
metadata-evalN/A
lower-*.f32N/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.7
Applied rewrites91.7%
(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.9996200203895569)
(* t_1 (sqrt (- 1.0 (* t_0 (- 1.0 ux)))))
(* t_1 (sqrt (* ux (* 2.0 (- 1.0 maxCos))))))))\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.9996200203895569:\\
\;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{ux \cdot \left(2 \cdot \left(1 - maxCos\right)\right)}\\
\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.99962002Initial program 89.7%
Taylor expanded in maxCos around 0
lower--.f3287.3
Applied rewrites87.3%
if 0.99962002 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
Taylor expanded in ux around 0
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
metadata-evalN/A
lower-*.f32N/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.7
Applied rewrites91.7%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9996600151062012)
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(-
(/ 2.0 ux)
(fma (/ maxCos ux) 2.0 (* (- maxCos 1.0) (- maxCos 1.0))))
(* ux ux))))
(* (sin (* (* uy 2.0) (PI))) (sqrt (* ux (* 2.0 (- 1.0 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.9996600151062012:\\
\;\;\;\;\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}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(2 \cdot \left(1 - maxCos\right)\right)}\\
\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.999660015Initial program 89.1%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.2
Applied rewrites77.2%
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
+-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lower-*.f3275.1
Applied rewrites74.9%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites79.8%
if 0.999660015 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 38.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--.f3238.2
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.2
Applied rewrites38.2%
Taylor expanded in ux around 0
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
metadata-evalN/A
lower-*.f32N/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3292.1
Applied rewrites92.1%
Final simplification87.3%
(FPCore (ux uy maxCos) :precision binary32 (if (<= ux 0.0001900000061141327) (* (sin (* (* uy 2.0) (PI))) (sqrt (* ux (* 2.0 (- 1.0 maxCos))))) (* (sin (* (* (PI) uy) 2.0)) (sqrt (- 1.0 (* (- 1.0 ux) (- 1.0 ux)))))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.0001900000061141327:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(2 \cdot \left(1 - maxCos\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if ux < 1.90000006e-4Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
Taylor expanded in ux around 0
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
metadata-evalN/A
lower-*.f32N/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.7
Applied rewrites91.7%
if 1.90000006e-4 < ux Initial program 89.7%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.4
Applied rewrites77.4%
Taylor expanded in maxCos around 0
lower--.f3275.3
Applied rewrites75.3%
Taylor expanded in maxCos around 0
lower--.f3275.0
Applied rewrites75.0%
Taylor expanded in uy around inf
count-2-revN/A
distribute-lft-inN/A
count-2-revN/A
lower-sin.f32N/A
count-2-revN/A
distribute-lft-inN/A
count-2-revN/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3287.0
Applied rewrites87.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= uy 0.0015999999595806003)
(*
t_0
(sqrt
(*
(-
(/ 2.0 ux)
(fma (/ maxCos ux) 2.0 (* (- maxCos 1.0) (- maxCos 1.0))))
(* ux ux))))
(* (sin t_0) (sqrt (* (fma -2.0 maxCos 2.0) ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;uy \leq 0.0015999999595806003:\\
\;\;\;\;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}:\\
\;\;\;\;\sin t\_0 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\end{array}
\end{array}
if uy < 0.00159999996Initial program 58.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3258.1
Applied rewrites58.1%
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
+-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lower-*.f3256.7
Applied rewrites54.8%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites89.9%
if 0.00159999996 < uy Initial program 58.1%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f3258.8
Applied rewrites58.8%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
count-2-revN/A
distribute-lft-inN/A
count-2-revN/A
lower-sin.f32N/A
count-2-revN/A
distribute-lft-inN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-sqrt.f32N/A
*-commutativeN/A
Applied rewrites10.0%
Final simplification66.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ -1.0 (- ux (* maxCos ux)))) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.013199999928474426)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt (* (- 1.0 maxCos) ux)))
(* (* (* (PI) 2.0) uy) (sqrt (- 1.0 (* t_0 t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \left(ux - maxCos \cdot ux\right)\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.013199999928474426:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot ux}\\
\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 (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.0132Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Taylor expanded in uy around 0
Applied rewrites77.1%
if 0.0132 < (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 88.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3276.5
Applied rewrites76.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
mul-fabsN/A
lower-fabs.f32N/A
lower-*.f32N/A
lower--.f32N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
Applied rewrites76.9%
Final simplification77.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.013199999928474426)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt (* (- 1.0 maxCos) ux)))
(*
(* (+ (PI) (PI)) uy)
(sqrt (- 1.0 (* (- 1.0 (- ux (* maxCos ux))) t_0)))))))\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.013199999928474426:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot t\_0}\\
\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.0132Initial program 36.7%
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--.f3236.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3236.6
Applied rewrites36.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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.1
Applied rewrites93.1%
Taylor expanded in uy around 0
Applied rewrites77.1%
if 0.0132 < (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 88.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3276.5
Applied rewrites76.5%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3276.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3276.6
Applied rewrites76.6%
Applied rewrites76.6%
Final simplification76.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.019500000402331352)
(* (* (* (* (sqrt 2.0) (PI)) uy) 2.0) (sqrt (* (- 1.0 maxCos) ux)))
(*
(* (* (PI) 2.0) uy)
(sqrt (- 1.0 (* (- 1.0 (- ux (* maxCos 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.019500000402331352:\\
\;\;\;\;\left(\left(\left(\sqrt{2} \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\left(1 - maxCos\right) \cdot ux}\\
\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(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.0195000004Initial program 38.9%
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--.f3238.8
lift-*.f32N/A
*-commutativeN/A
lower-*.f3238.8
Applied rewrites38.8%
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
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3291.9
Applied rewrites91.9%
Taylor expanded in uy around 0
Applied rewrites76.5%
if 0.0195000004 < (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 89.7%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.4
Applied rewrites77.4%
Taylor expanded in maxCos around 0
lower--.f3275.3
Applied rewrites75.3%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift--.f32N/A
lower--.f3275.3
Applied rewrites75.3%
Final simplification76.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.006949999835342169)
(* t_0 (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* t_0 (sqrt (- 1.0 (* (- 1.0 (- ux (* maxCos ux))) (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.006949999835342169:\\
\;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\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.00694999984Initial program 33.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3230.1
Applied rewrites30.1%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3230.3
lift-*.f32N/A
*-commutativeN/A
lower-*.f3230.3
Applied rewrites30.3%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3272.9
Applied rewrites58.1%
if 0.00694999984 < (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 86.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.4
Applied rewrites74.4%
Taylor expanded in maxCos around 0
lower--.f3272.5
Applied rewrites72.5%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift--.f32N/A
lower--.f3272.5
Applied rewrites72.5%
Final simplification72.7%
(FPCore (ux uy maxCos)
:precision binary32
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(- (/ 2.0 ux) (fma (/ maxCos ux) 2.0 (* (- maxCos 1.0) (- maxCos 1.0))))
(* ux ux)))))\begin{array}{l}
\\
\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)}
\end{array}
Initial program 58.3%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.8
Applied rewrites50.8%
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
+-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
*-commutativeN/A
lower-*.f3249.8
Applied rewrites48.0%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites76.5%
Final simplification76.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 2.4000000848900527e-5)
(* t_0 (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* t_0 (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 2.4000000848900527 \cdot 10^{-5}:\\
\;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if ux < 2.40000008e-5Initial program 33.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3230.1
Applied rewrites30.1%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3230.3
lift-*.f32N/A
*-commutativeN/A
lower-*.f3230.3
Applied rewrites30.3%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3272.9
Applied rewrites69.0%
if 2.40000008e-5 < ux Initial program 86.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.4
Applied rewrites74.4%
Taylor expanded in maxCos around 0
lower--.f3272.5
Applied rewrites72.5%
Final simplification72.7%
(FPCore (ux uy maxCos) :precision binary32 (if (<= ux 2.4000000848900527e-5) (* (* (* (PI) 2.0) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux))) (* (* (+ (PI) (PI)) uy) (sqrt (- 1.0 (* (- 1.0 ux) (- 1.0 ux)))))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 2.4000000848900527 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot \sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}\\
\end{array}
\end{array}
if ux < 2.40000008e-5Initial program 33.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3230.1
Applied rewrites30.1%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3230.3
lift-*.f32N/A
*-commutativeN/A
lower-*.f3230.3
Applied rewrites30.3%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3272.9
Applied rewrites70.2%
if 2.40000008e-5 < ux Initial program 86.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3274.4
Applied rewrites74.4%
Taylor expanded in maxCos around 0
lower--.f3272.5
Applied rewrites72.5%
Taylor expanded in maxCos around 0
lower--.f3272.3
Applied rewrites72.3%
Applied rewrites72.3%
Final simplification72.6%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* (PI) 2.0) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux))))
\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
\end{array}
Initial program 58.3%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.8
Applied rewrites50.8%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3251.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3251.0
Applied rewrites51.0%
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.4
Applied rewrites55.6%
Final simplification62.4%
herbie shell --seed 2024339
(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)))))))