
(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 16 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 (* ux (pow (- maxCos 1.0) 2.0))) (* maxCos 2.0)) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(\left(2 - ux \cdot {\left(maxCos - 1\right)}^{2}\right) - maxCos \cdot 2\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 56.4%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3256.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3256.6
Applied rewrites56.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.2
Applied rewrites98.2%
Final simplification98.2%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- 2.0 (- (* ux (pow (- maxCos 1.0) 2.0)) (* -2.0 maxCos))) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(2 - \left(ux \cdot {\left(maxCos - 1\right)}^{2} - -2 \cdot maxCos\right)\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 56.4%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3256.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3256.6
Applied rewrites56.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.2
Applied rewrites98.2%
Applied rewrites98.2%
Final simplification98.2%
(FPCore (ux uy maxCos)
:precision binary32
(*
(sqrt
(-
(- ux (* ux maxCos))
(* (* (fma maxCos ux (- 1.0 ux)) ux) (- maxCos 1.0))))
(sin (* (PI) (* 2.0 uy)))))\begin{array}{l}
\\
\sqrt{\left(ux - ux \cdot maxCos\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot ux\right) \cdot \left(maxCos - 1\right)} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 56.4%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f32N/A
Applied rewrites20.0%
lift--.f32N/A
lift-+.f32N/A
associate--r+N/A
lower--.f32N/A
lift-fma.f32N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f32N/A
lift--.f32N/A
associate-+l-N/A
associate--r-N/A
metadata-evalN/A
lower-+.f32N/A
lower--.f3249.1
lift-*.f32N/A
*-commutativeN/A
lower-*.f3250.4
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-+.f32N/A
Applied rewrites48.0%
Final simplification49.2%
(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 56.4%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3256.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3256.6
Applied rewrites56.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.2
Applied rewrites98.2%
Taylor expanded in maxCos around 0
Applied rewrites86.5%
Final simplification86.6%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (+ (* (- 1.0 ux) ux) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(1 - ux\right) \cdot ux + ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 56.4%
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
sub-negN/A
associate-+l+N/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
lower-*.f32N/A
lift-+.f32N/A
+-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lower-fma.f32N/A
neg-mul-1N/A
lift-*.f32N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f32N/A
Applied rewrites20.1%
Taylor expanded in maxCos around 0
associate-*r*N/A
mul-1-negN/A
cancel-sign-subN/A
lower-+.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3294.3
Applied rewrites94.3%
Final simplification94.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- 2.0 ux) ux)) (sin (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(2 - ux\right) \cdot ux} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 56.4%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3256.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3256.6
Applied rewrites56.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-pow.f32N/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.2
Applied rewrites98.2%
Taylor expanded in maxCos around 0
Applied rewrites94.2%
Final simplification94.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0
(* (fma (* -1.3333333333333333 (* uy uy)) (* (PI) (PI)) 2.0) (PI)))
(t_1 (- (+ -1.0 ux) (* ux maxCos))))
(if (<= (- 1.0 (* t_1 t_1)) 0.0)
(* t_0 (* (sqrt (* (fma -2.0 maxCos 2.0) ux)) uy))
(*
(*
(sqrt
(-
(* (* (- ux (fma ux maxCos 1.0)) ux) (- maxCos 1.0))
(* ux (- maxCos 1.0))))
uy)
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 2\right) \cdot \mathsf{PI}\left(\right)\\
t_1 := \left(-1 + ux\right) - ux \cdot maxCos\\
\mathbf{if}\;1 - t\_1 \cdot t\_1 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(\left(ux - \mathsf{fma}\left(ux, maxCos, 1\right)\right) \cdot ux\right) \cdot \left(maxCos - 1\right) - ux \cdot \left(maxCos - 1\right)} \cdot uy\right) \cdot t\_0\\
\end{array}
\end{array}
if (-.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.0Initial program 7.4%
Taylor expanded in uy around 0
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites7.5%
Taylor expanded in ux around 0
Applied rewrites75.9%
if 0.0 < (-.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 72.1%
Taylor expanded in uy around 0
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites63.1%
Applied rewrites81.6%
Final simplification79.7%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= ux 0.0001500000071246177)
(*
(* (fma (* -1.3333333333333333 (* uy uy)) (* (PI) (PI)) 2.0) (PI))
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) uy))
(*
(sqrt
(-
1.0
(* (* (- (+ (/ 1.0 ux) maxCos) 1.0) ux) (- (* ux maxCos) (+ -1.0 ux)))))
(* (* (PI) 2.0) uy))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.0001500000071246177:\\
\;\;\;\;\left(\mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\left(\left(\frac{1}{ux} + maxCos\right) - 1\right) \cdot ux\right) \cdot \left(ux \cdot maxCos - \left(-1 + ux\right)\right)} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites33.0%
Taylor expanded in ux around 0
Applied rewrites74.7%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
+-commutativeN/A
lower-+.f32N/A
lower-/.f3290.5
Applied rewrites90.5%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3278.2
Applied rewrites78.2%
Final simplification75.7%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= ux 0.0001500000071246177)
(*
(* (fma (* -1.3333333333333333 (* uy uy)) (* (PI) (PI)) 2.0) (PI))
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) uy))
(*
(sqrt
(-
1.0
(*
(* (+ (/ (- 1.0 ux) maxCos) ux) maxCos)
(- (* ux maxCos) (+ -1.0 ux)))))
(* (* (PI) 2.0) uy))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.0001500000071246177:\\
\;\;\;\;\left(\mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\left(\frac{1 - ux}{maxCos} + ux\right) \cdot maxCos\right) \cdot \left(ux \cdot maxCos - \left(-1 + ux\right)\right)} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites33.0%
Taylor expanded in ux around 0
Applied rewrites75.2%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.9
Applied rewrites77.9%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
lower-/.f32N/A
lower--.f3278.1
Applied rewrites78.1%
Final simplification74.6%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= ux 0.0001500000071246177)
(*
(* (fma (* -1.3333333333333333 (* uy uy)) (* (PI) (PI)) 2.0) (PI))
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) uy))
(*
(sqrt
(- 1.0 (* (- 1.0 (- ux (* ux maxCos))) (- (* ux maxCos) (+ -1.0 ux)))))
(* (* (PI) 2.0) uy))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ux \leq 0.0001500000071246177:\\
\;\;\;\;\left(\mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot uy\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(ux \cdot maxCos - \left(-1 + ux\right)\right)} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right)\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites33.0%
Taylor expanded in ux around 0
Applied rewrites74.7%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.9
Applied rewrites77.9%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3278.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3278.0
Applied rewrites78.0%
Final simplification76.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001500000071246177)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_0)
(*
(sqrt
(- 1.0 (* (- 1.0 (- ux (* ux maxCos))) (- (* ux maxCos) (+ -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.0001500000071246177:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(ux \cdot maxCos - \left(-1 + ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3233.0
Applied rewrites33.0%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3275.2
Applied rewrites74.8%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.9
Applied rewrites77.9%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3278.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3278.0
Applied rewrites78.0%
Final simplification75.4%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (- (+ -1.0 ux) (* ux maxCos))) (t_1 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001500000071246177)
(* (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 := \left(-1 + ux\right) - ux \cdot maxCos\\
t_1 := \left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\\
\mathbf{if}\;ux \leq 0.0001500000071246177:\\
\;\;\;\;\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.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3233.0
Applied rewrites33.0%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3275.2
Applied rewrites74.8%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.9
Applied rewrites77.9%
Final simplification76.3%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) 2.0) uy)))
(if (<= ux 0.0001500000071246177)
(* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_0)
(* (sqrt (- 1.0 (* (- 1.0 ux) (- (* ux maxCos) (+ -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.0001500000071246177:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - ux\right) \cdot \left(ux \cdot maxCos - \left(-1 + ux\right)\right)} \cdot t\_0\\
\end{array}
\end{array}
if ux < 1.50000007e-4Initial program 34.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3233.0
Applied rewrites33.0%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3273.4
Applied rewrites74.8%
if 1.50000007e-4 < ux Initial program 89.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.9
Applied rewrites77.9%
Taylor expanded in maxCos around 0
lower--.f3276.3
Applied rewrites76.3%
Final simplification73.8%
(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 56.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.7
Applied rewrites50.7%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3264.3
Applied rewrites64.1%
Final simplification64.3%
(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 56.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.7
Applied rewrites50.7%
Taylor expanded in ux around 0
Applied rewrites7.1%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
neg-mul-1N/A
lower-fma.f3220.6
Applied rewrites20.5%
Final simplification20.6%
(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 56.4%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.7
Applied rewrites50.7%
Taylor expanded in ux around 0
Applied rewrites7.1%
Final simplification7.1%
herbie shell --seed 2024276
(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)))))))