
(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 14 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 (* (sqrt (* (- (* -2.0 maxCos) (- (* (pow (- maxCos 1.0) 2.0) ux) 2.0)) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(-2 \cdot maxCos - \left({\left(maxCos - 1\right)}^{2} \cdot ux - 2\right)\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 55.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f322.5
Applied rewrites3.4%
Applied rewrites98.3%
Final simplification98.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- (- 2.0 (* (fma -2.0 ux 2.0) maxCos)) ux) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(\left(2 - \mathsf{fma}\left(-2, ux, 2\right) \cdot maxCos\right) - ux\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 55.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f323.0
Applied rewrites2.7%
Applied rewrites98.3%
Taylor expanded in maxCos around 0
Applied rewrites84.8%
Final simplification83.9%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.0001500000071246177)
(*
(sqrt
(-
(* (* ux ux) (- (/ 2.0 ux) (- (/ maxCos ux) (- maxCos 1.0))))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
(* (* (PI) 2.0) uy))
(* (sqrt (* (- 2.0 ux) ux)) (sin (* (PI) (* 2.0 uy))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.0001500000071246177:\\
\;\;\;\;\sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} - \left(\frac{maxCos}{ux} - \left(maxCos - 1\right)\right)\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 1.50000007e-4Initial program 56.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3256.0
Applied rewrites56.0%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f32N/A
lower--.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
Applied rewrites26.9%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3298.0
Applied rewrites97.3%
if 1.50000007e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 53.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f323.0
Applied rewrites2.3%
Taylor expanded in maxCos around 0
Applied rewrites93.1%
Final simplification89.2%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sqrt
(-
(* (* ux ux) (- (/ 2.0 ux) (- (/ maxCos ux) (- maxCos 1.0))))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
(* (* (PI) 2.0) uy)))\begin{array}{l}
\\
\sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} - \left(\frac{maxCos}{ux} - \left(maxCos - 1\right)\right)\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)
\end{array}
Initial program 55.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3247.2
Applied rewrites47.2%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f32N/A
lower--.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
Applied rewrites29.4%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3278.8
Applied rewrites78.4%
Final simplification78.5%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sqrt
(-
(* (- (/ (- 2.0 maxCos) ux) (- 1.0 maxCos)) (* ux ux))
(* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
(* (* (PI) 2.0) uy)))\begin{array}{l}
\\
\sqrt{\left(\frac{2 - maxCos}{ux} - \left(1 - maxCos\right)\right) \cdot \left(ux \cdot ux\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)
\end{array}
Initial program 55.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3247.2
Applied rewrites47.2%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f32N/A
lower--.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
Applied rewrites24.2%
Taylor expanded in ux around -inf
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
sub-negN/A
mul-1-negN/A
lower--.f32N/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
unpow2N/A
lower-*.f3278.7
Applied rewrites78.7%
Final simplification78.7%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= ux 0.0001250000059371814)
(*
(sqrt
(- (* (- 2.0 maxCos) ux) (* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
(* (* (PI) 2.0) uy))
(*
(sqrt
(-
1.0
(* (* (- (+ (/ 1.0 ux) maxCos) 1.0) ux) (+ (* maxCos ux) (- 1.0 ux)))))
(* (PI) (* 2.0 uy)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\left(2 - maxCos\right) \cdot ux - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\left(\left(\frac{1}{ux} + maxCos\right) - 1\right) \cdot ux\right) \cdot \left(maxCos \cdot ux + \left(1 - ux\right)\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f32N/A
lower--.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
Applied rewrites17.7%
Taylor expanded in ux around 0
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-*.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3274.3
Applied rewrites73.6%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f3287.5
Applied rewrites87.5%
Taylor expanded in uy around 0
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f3273.7
Applied rewrites73.7%
Final simplification74.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001250000059371814)
(*
(sqrt
(- (* (- 2.0 maxCos) ux) (* (* (fma maxCos ux (- 1.0 ux)) maxCos) ux)))
t_0)
(*
(sqrt
(- 1.0 (* (- 1.0 (- ux (* maxCos ux))) (+ (* maxCos ux) (- 1.0 ux)))))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\left(2 - maxCos\right) \cdot ux - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot \left(maxCos \cdot ux + \left(1 - ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
lift--.f32N/A
lift-*.f32N/A
lift-+.f32N/A
distribute-lft-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f32N/A
lower--.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
*-commutativeN/A
Applied rewrites18.4%
Taylor expanded in ux around 0
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-*.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3274.3
Applied rewrites73.6%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3273.5
Applied rewrites73.5%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3273.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3273.7
Applied rewrites73.7%
Final simplification74.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001250000059371814)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_0)
(*
(sqrt
(- 1.0 (* (- 1.0 (- ux (* maxCos ux))) (+ (* maxCos ux) (- 1.0 ux)))))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - \left(ux - maxCos \cdot ux\right)\right) \cdot \left(maxCos \cdot ux + \left(1 - ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3230.8
Applied rewrites30.8%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.2
Applied rewrites69.5%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3273.5
Applied rewrites73.5%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3273.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3273.7
Applied rewrites73.7%
Final simplification71.6%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (* maxCos ux) (- 1.0 ux))) (t_1 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001250000059371814)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_1)
(* (sqrt (- 1.0 (* t_0 t_0))) t_1))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := maxCos \cdot ux + \left(1 - ux\right)\\
t_1 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - t\_0 \cdot t\_0} \cdot t\_1\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3230.8
Applied rewrites30.8%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3257.6
Applied rewrites70.2%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3273.5
Applied rewrites73.5%
Final simplification70.6%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001250000059371814)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_0)
(*
(sqrt
(- 1.0 (* (- (fma maxCos ux 1.0) ux) (+ (* maxCos ux) (- 1.0 ux)))))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\mathsf{fma}\left(maxCos, ux, 1\right) - ux\right) \cdot \left(maxCos \cdot ux + \left(1 - ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3230.8
Applied rewrites30.8%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.2
Applied rewrites70.2%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3273.5
Applied rewrites73.5%
lift-+.f32N/A
+-commutativeN/A
lift--.f32N/A
associate-+r-N/A
lower--.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f3270.8
Applied rewrites63.6%
Final simplification70.4%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001250000059371814)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_0)
(* (sqrt (- 1.0 (* (- 1.0 ux) (+ (* maxCos ux) (- 1.0 ux))))) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001250000059371814:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - ux\right) \cdot \left(maxCos \cdot ux + \left(1 - ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.25000006e-4Initial program 33.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3229.5
Applied rewrites29.5%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3230.8
Applied rewrites30.8%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.2
Applied rewrites69.5%
if 1.25000006e-4 < ux Initial program 86.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3273.5
Applied rewrites73.5%
Taylor expanded in maxCos around 0
lower--.f3270.8
Applied rewrites70.8%
Final simplification69.6%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (fma -2.0 maxCos 2.0) ux)) (* (* (PI) 2.0) uy)))
\begin{array}{l}
\\
\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)
\end{array}
Initial program 55.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3247.2
Applied rewrites47.2%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3247.6
Applied rewrites47.6%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3261.2
Applied rewrites61.2%
Final simplification60.8%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (fma -1.0 1.0 1.0)) (* (* (PI) 2.0) uy)))
\begin{array}{l}
\\
\sqrt{\mathsf{fma}\left(-1, 1, 1\right)} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)
\end{array}
Initial program 55.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3247.2
Applied rewrites47.2%
Taylor expanded in ux around 0
Applied rewrites7.1%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
neg-mul-1N/A
lower-fma.f3219.4
Applied rewrites19.4%
Final simplification19.4%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (- 1.0 1.0)) (* (* (PI) 2.0) uy)))
\begin{array}{l}
\\
\sqrt{1 - 1} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)
\end{array}
Initial program 55.0%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3247.2
Applied rewrites47.2%
Taylor expanded in ux around 0
Applied rewrites7.1%
Final simplification7.1%
herbie shell --seed 2024283
(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)))))))