
(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 23 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 (* (sin (fma (* -2.0 uy) (PI) (/ (PI) 2.0))) (sqrt (fma (fma maxCos -2.0 2.0) ux (* (* (pow (- maxCos 1.0) 2.0) (- ux)) ux)))))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(-2 \cdot uy, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left({\left(maxCos - 1\right)}^{2} \cdot \left(-ux\right)\right) \cdot ux\right)}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification99.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (fma (* -2.0 uy) (PI) (/ (PI) 2.0))) (sqrt (* (fma -2.0 maxCos (- 2.0 (* (pow (- maxCos 1.0) 2.0) ux))) ux))))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(-2 \cdot uy, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2 - {\left(maxCos - 1\right)}^{2} \cdot ux\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Final simplification99.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (fma (* (PI) uy) -2.0 (* 0.5 (PI)))) (sqrt (* (fma -2.0 maxCos (- 2.0 (* (pow (- maxCos 1.0) 2.0) ux))) ux))))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot uy, -2, 0.5 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2 - {\left(maxCos - 1\right)}^{2} \cdot ux\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Taylor expanded in uy around 0
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-PI.f3299.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (* uy 2.0) (PI))) (sqrt (* (fma -2.0 maxCos (- 2.0 (* (pow (- maxCos 1.0) 2.0) ux))) ux))))
\begin{array}{l}
\\
\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2 - {\left(maxCos - 1\right)}^{2} \cdot ux\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (fma (* -2.0 uy) (PI) (/ (PI) 2.0))) (sqrt (- (* (- 2.0 ux) ux) (* (* (fma -2.0 ux 2.0) ux) maxCos)))))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(-2 \cdot uy, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \sqrt{\left(2 - ux\right) \cdot ux - \left(\mathsf{fma}\left(-2, ux, 2\right) \cdot ux\right) \cdot maxCos}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Taylor expanded in maxCos around 0
Applied rewrites98.8%
Final simplification98.8%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= maxCos 7.000000096013537e-6)
(*
(sin (fma (* -2.0 uy) (PI) (/ (PI) 2.0)))
(sqrt (fma (- ux) ux (* 2.0 ux))))
(*
(fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
(sqrt
(*
(- (- 2.0 (* (* (- maxCos 1.0) (+ -1.0 maxCos)) ux)) (* 2.0 maxCos))
ux)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 7.000000096013537 \cdot 10^{-6}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(-2 \cdot uy, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \sqrt{\mathsf{fma}\left(-ux, ux, 2 \cdot ux\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(2 - \left(\left(maxCos - 1\right) \cdot \left(-1 + maxCos\right)\right) \cdot ux\right) - 2 \cdot maxCos\right) \cdot ux}\\
\end{array}
\end{array}
if maxCos < 7.0000001e-6Initial program 60.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Applied rewrites99.3%
Taylor expanded in maxCos around 0
Applied rewrites99.0%
if 7.0000001e-6 < maxCos Initial program 58.6%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3257.2
Applied rewrites57.2%
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 rewrites55.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites96.5%
Final simplification98.8%
(FPCore (ux uy maxCos) :precision binary32 (* (cos (* (* uy 2.0) (PI))) (sqrt (- (* (- 2.0 ux) ux) (* (* (fma -2.0 ux 2.0) ux) maxCos)))))
\begin{array}{l}
\\
\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(2 - ux\right) \cdot ux - \left(\mathsf{fma}\left(-2, ux, 2\right) \cdot ux\right) \cdot maxCos}
\end{array}
Initial program 60.1%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
Taylor expanded in maxCos around 0
Applied rewrites98.6%
Final simplification98.6%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= maxCos 7.000000096013537e-6)
(* (sin (fma (* -2.0 uy) (PI) (/ (PI) 2.0))) (sqrt (* (- 2.0 ux) ux)))
(*
(fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
(sqrt
(*
(- (- 2.0 (* (* (- maxCos 1.0) (+ -1.0 maxCos)) ux)) (* 2.0 maxCos))
ux)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 7.000000096013537 \cdot 10^{-6}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(-2 \cdot uy, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \sqrt{\left(2 - ux\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(2 - \left(\left(maxCos - 1\right) \cdot \left(-1 + maxCos\right)\right) \cdot ux\right) - 2 \cdot maxCos\right) \cdot ux}\\
\end{array}
\end{array}
if maxCos < 7.0000001e-6Initial program 60.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
lift-cos.f32N/A
cos-neg-revN/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f32N/A
distribute-lft-neg-outN/A
lift-neg.f32N/A
sin-+PI/2N/A
lift-PI.f32N/A
lift-/.f32N/A
lift-fma.f32N/A
lift-sin.f3299.3
lift-fma.f32N/A
Applied rewrites99.3%
Taylor expanded in maxCos around 0
Applied rewrites99.0%
if 7.0000001e-6 < maxCos Initial program 58.6%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3257.2
Applied rewrites57.2%
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 rewrites55.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites96.5%
Final simplification98.8%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= maxCos 7.000000096013537e-6)
(* (cos (* (* uy 2.0) (PI))) (sqrt (* (- 2.0 ux) ux)))
(*
(fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
(sqrt
(*
(- (- 2.0 (* (* (- maxCos 1.0) (+ -1.0 maxCos)) ux)) (* 2.0 maxCos))
ux)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 7.000000096013537 \cdot 10^{-6}:\\
\;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(2 - ux\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(2 - \left(\left(maxCos - 1\right) \cdot \left(-1 + maxCos\right)\right) \cdot ux\right) - 2 \cdot maxCos\right) \cdot ux}\\
\end{array}
\end{array}
if maxCos < 7.0000001e-6Initial program 60.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f3299.0
Applied rewrites99.0%
Taylor expanded in maxCos around 0
Applied rewrites98.7%
if 7.0000001e-6 < maxCos Initial program 58.6%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3257.2
Applied rewrites57.2%
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 rewrites55.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites96.5%
Final simplification98.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_0 t_0))) 0.014999999664723873)
(*
(fma (* (* (* uy uy) -2.0) (PI)) (PI) 1.0)
(sqrt (* (fma -2.0 maxCos 2.0) ux)))
(*
(fma (* (* (PI) (PI)) (* uy uy)) -2.0 1.0)
(sqrt (- 1.0 (* t_0 (fma (- maxCos 1.0) ux 1.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.014999999664723873:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(uy \cdot uy\right), -2, 1\right) \cdot \sqrt{1 - t\_0 \cdot \mathsf{fma}\left(maxCos - 1, ux, 1\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.0149999997Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3284.3
Applied rewrites84.3%
Applied rewrites84.3%
if 0.0149999997 < (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.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
Applied rewrites81.0%
Taylor expanded in ux around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lower--.f3281.2
Applied rewrites81.2%
Final simplification82.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* uy uy) -2.0)) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.014999999664723873)
(* (fma (* t_0 (PI)) (PI) 1.0) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(*
(fma t_0 (* (PI) (PI)) 1.0)
(sqrt (- 1.0 (* t_1 (fma (- maxCos 1.0) ux 1.0))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(uy \cdot uy\right) \cdot -2\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.014999999664723873:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - t\_1 \cdot \mathsf{fma}\left(maxCos - 1, ux, 1\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.0149999997Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3284.3
Applied rewrites84.3%
Applied rewrites84.3%
if 0.0149999997 < (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.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
Taylor expanded in ux around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lower--.f3281.2
Applied rewrites81.2%
Final simplification82.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (fma ux maxCos (- 1.0 ux))) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.02199999988079071)
(*
(+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))
(sqrt (* (fma -2.0 maxCos 2.0) ux)))
(*
(fma (* (* (PI) (PI)) (* uy uy)) -2.0 1.0)
(sqrt (fma t_0 (- t_0) 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(ux, maxCos, 1 - ux\right)\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.02199999988079071:\\
\;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(uy \cdot uy\right), -2, 1\right) \cdot \sqrt{\mathsf{fma}\left(t\_0, -t\_0, 1\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.0219999999Initial program 37.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3235.0
Applied rewrites35.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.f3283.8
Applied rewrites83.8%
Applied rewrites83.8%
if 0.0219999999 < (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.8%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.6
Applied rewrites81.6%
Applied rewrites81.6%
lift--.f32N/A
lift-*.f32N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
lower-fma.f32N/A
lower-neg.f3281.7
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
lower-fma.f3281.7
Applied rewrites81.7%
Final simplification82.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (fma maxCos ux (- 1.0 ux)))
(t_1 (* (* uy uy) -2.0))
(t_2 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_2 t_2))) 0.02199999988079071)
(* (+ 1.0 (* (* t_1 (PI)) (PI))) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* (fma t_1 (* (PI) (PI)) 1.0) (sqrt (fma t_0 (- t_0) 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(maxCos, ux, 1 - ux\right)\\
t_1 := \left(uy \cdot uy\right) \cdot -2\\
t_2 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_2 \cdot t\_2} \leq 0.02199999988079071:\\
\;\;\;\;\left(1 + \left(t\_1 \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(t\_0, -t\_0, 1\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.0219999999Initial program 37.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3235.0
Applied rewrites35.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.f3283.8
Applied rewrites83.8%
Applied rewrites83.8%
if 0.0219999999 < (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.8%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.6
Applied rewrites81.6%
lift--.f32N/A
lift-*.f32N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
lower-neg.f3281.7
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f3281.7
Applied rewrites81.7%
Final simplification82.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* uy uy) -2.0)) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (sqrt (- 1.0 (* t_1 t_1))) 0.014999999664723873)
(* (fma (* t_0 (PI)) (PI) 1.0) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
(* (fma t_0 (* (PI) (PI)) 1.0) (sqrt (- 1.0 (* t_1 (- 1.0 ux))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(uy \cdot uy\right) \cdot -2\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;\sqrt{1 - t\_1 \cdot t\_1} \leq 0.014999999664723873:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - t\_1 \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.0149999997Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3284.3
Applied rewrites84.3%
Applied rewrites84.3%
if 0.0149999997 < (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.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
Taylor expanded in maxCos around 0
lower--.f3279.2
Applied rewrites79.2%
Final simplification82.1%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))
(t_1 (fma maxCos ux (- 1.0 ux)))
(t_2 (* (* uy uy) -2.0)))
(if (<= (* t_0 t_0) 0.9997000098228455)
(* (fma t_2 (* (PI) (PI)) 1.0) (sqrt (- 1.0 (* t_1 t_1))))
(* (fma (* t_2 (PI)) (PI) 1.0) (sqrt (* (fma -2.0 maxCos 2.0) ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
t_1 := \mathsf{fma}\left(maxCos, ux, 1 - ux\right)\\
t_2 := \left(uy \cdot uy\right) \cdot -2\\
\mathbf{if}\;t\_0 \cdot t\_0 \leq 0.9997000098228455:\\
\;\;\;\;\mathsf{fma}\left(t\_2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - t\_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\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.99970001Initial program 90.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
lift-*.f32N/A
pow2N/A
lift-+.f32N/A
lift-*.f32N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f32N/A
pow2N/A
lift-*.f3281.0
Applied rewrites81.0%
if 0.99970001 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3284.3
Applied rewrites84.3%
Applied rewrites84.3%
Final simplification82.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_0 t_0) 0.9997000098228455)
(*
(fma (* (* (PI) (PI)) (* uy uy)) -2.0 1.0)
(sqrt (- 1.0 (* t_0 (- 1.0 ux)))))
(*
(fma (* (* (* uy uy) -2.0) (PI)) (PI) 1.0)
(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.9997000098228455:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(uy \cdot uy\right), -2, 1\right) \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\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.99970001Initial program 90.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
Applied rewrites81.0%
Taylor expanded in maxCos around 0
lower--.f3279.2
Applied rewrites79.2%
if 0.99970001 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3284.3
Applied rewrites84.3%
Applied rewrites84.3%
Final simplification82.1%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- (fma maxCos ux 1.0) ux)) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_1 t_1) 0.9995049834251404)
(sqrt (- 1.0 (fma (* t_0 ux) maxCos (* t_0 (- 1.0 ux)))))
(*
(+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))
(sqrt (* (fma -2.0 maxCos 2.0) ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(maxCos, ux, 1\right) - ux\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;t\_1 \cdot t\_1 \leq 0.9995049834251404:\\
\;\;\;\;\sqrt{1 - \mathsf{fma}\left(t\_0 \cdot ux, maxCos, t\_0 \cdot \left(1 - ux\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\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.999504983Initial program 91.0%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.4
Applied rewrites81.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 rewrites81.3%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower--.f3276.6
Applied rewrites76.6%
if 0.999504983 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 37.5%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3235.4
Applied rewrites35.4%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3283.7
Applied rewrites83.7%
Applied rewrites83.7%
Final simplification80.7%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- (fma maxCos ux 1.0) ux)) (t_1 (+ (- 1.0 ux) (* ux maxCos))))
(if (<= (* t_1 t_1) 0.9995049834251404)
(sqrt (- 1.0 (fma (* t_0 ux) maxCos (* t_0 (- 1.0 ux)))))
(*
(fma (* (* (* uy uy) -2.0) (PI)) (PI) 1.0)
(sqrt (* (fma -2.0 maxCos 2.0) ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(maxCos, ux, 1\right) - ux\\
t_1 := \left(1 - ux\right) + ux \cdot maxCos\\
\mathbf{if}\;t\_1 \cdot t\_1 \leq 0.9995049834251404:\\
\;\;\;\;\sqrt{1 - \mathsf{fma}\left(t\_0 \cdot ux, maxCos, t\_0 \cdot \left(1 - ux\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\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.999504983Initial program 91.0%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.4
Applied rewrites81.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 rewrites81.3%
Taylor expanded in uy around 0
lower-sqrt.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower--.f3276.6
Applied rewrites76.6%
if 0.999504983 < (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) Initial program 37.5%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3235.4
Applied rewrites35.4%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3283.7
Applied rewrites83.7%
Applied rewrites83.7%
Final simplification80.7%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (PI) (PI))))
(if (<= ux 0.0001500000071246177)
(*
(fma (* (* uy uy) -2.0) t_0 1.0)
(sqrt
(- (* (- 2.0 maxCos) ux) (* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux))))
(*
(fma (* t_0 (* uy uy)) -2.0 1.0)
(sqrt
(-
1.0
(* (+ (- 1.0 ux) (* ux maxCos)) (fma (- maxCos 1.0) ux 1.0))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;ux \leq 0.0001500000071246177:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, t\_0, 1\right) \cdot \sqrt{\left(2 - maxCos\right) \cdot ux - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(uy \cdot uy\right), -2, 1\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \mathsf{fma}\left(maxCos - 1, ux, 1\right)}\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 36.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3234.1
Applied rewrites34.1%
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 rewrites31.8%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f3284.4
Applied rewrites84.4%
if 1.50000007e-4 < ux Initial program 90.2%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3281.0
Applied rewrites81.0%
Applied rewrites81.0%
Taylor expanded in ux around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lower--.f3281.2
Applied rewrites81.2%
(FPCore (ux uy maxCos)
:precision binary32
(*
(fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
(sqrt
(*
(- (- 2.0 (* (* (- maxCos 1.0) (+ -1.0 maxCos)) ux)) (* 2.0 maxCos))
ux))))\begin{array}{l}
\\
\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(2 - \left(\left(maxCos - 1\right) \cdot \left(-1 + maxCos\right)\right) \cdot ux\right) - 2 \cdot maxCos\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3254.8
Applied rewrites54.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 rewrites53.5%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites88.9%
(FPCore (ux uy maxCos) :precision binary32 (* (fma (* (* (* uy uy) -2.0) (PI)) (PI) 1.0) (sqrt (* (fma -2.0 maxCos 2.0) ux))))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3254.8
Applied rewrites54.8%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3268.6
Applied rewrites68.6%
Applied rewrites68.6%
Final simplification68.6%
(FPCore (ux uy maxCos) :precision binary32 (* (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0) (sqrt (* (fma -2.0 maxCos 2.0) ux))))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3254.8
Applied rewrites54.8%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3268.6
Applied rewrites68.6%
Final simplification68.6%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* -2.0 (PI)) (* (* (PI) uy) uy)) (sqrt (* (fma -2.0 maxCos 2.0) ux))))
\begin{array}{l}
\\
\left(\left(-2 \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot uy\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
\end{array}
Initial program 60.1%
Taylor expanded in uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3254.8
Applied rewrites54.8%
Taylor expanded in ux around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3268.6
Applied rewrites68.6%
Taylor expanded in uy around inf
Applied rewrites4.6%
Applied rewrites4.6%
Final simplification4.6%
herbie shell --seed 2025015
(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)))))))