
(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 10 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 (sin (* (* uy 2.0) (PI)))))
(if (<= maxCos 1.999999943436137e-9)
(* t_0 (sqrt (* (- 2.0 ux) ux)))
(*
t_0
(sqrt
(*
(*
(- (/ (- (- 2.0 (/ (- 2.0 ux) maxCos)) (* 2.0 ux)) (- maxCos)) ux)
(* maxCos maxCos))
ux))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;maxCos \leq 1.999999943436137 \cdot 10^{-9}:\\
\;\;\;\;t\_0 \cdot \sqrt{\left(2 - ux\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{\left(\left(\frac{\left(2 - \frac{2 - ux}{maxCos}\right) - 2 \cdot ux}{-maxCos} - ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot ux}\\
\end{array}
\end{array}
if maxCos < 1.99999994e-9Initial program 59.2%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3259.2
lift-*.f32N/A
*-commutativeN/A
lower-*.f3259.2
Applied rewrites59.2%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3259.5
Applied rewrites59.5%
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
lower-*.f3298.1
Applied rewrites98.1%
Taylor expanded in maxCos around 0
Applied rewrites98.1%
if 1.99999994e-9 < maxCos Initial program 56.8%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3257.1
lift-*.f32N/A
*-commutativeN/A
lower-*.f3257.1
Applied rewrites57.1%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3257.3
Applied rewrites57.3%
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
lower-*.f3298.5
Applied rewrites98.5%
Taylor expanded in maxCos around -inf
Applied rewrites98.8%
Final simplification98.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sin (* (* uy 2.0) (PI))) (sqrt (* (- 2.0 (- (* ux (pow (- maxCos 1.0) 2.0)) (* -2.0 maxCos))) ux))))
\begin{array}{l}
\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(2 - \left(ux \cdot {\left(maxCos - 1\right)}^{2} - -2 \cdot maxCos\right)\right) \cdot ux}
\end{array}
Initial program 58.6%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3258.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f3258.6
Applied rewrites58.6%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3258.9
Applied rewrites58.9%
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
lower-*.f3298.2
Applied rewrites98.2%
Applied rewrites98.3%
Final simplification98.3%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* uy 2.0) 0.0003319999959785491)
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(-
(+ (- 1.0 (- maxCos 1.0)) (* (* (- 1.0 maxCos) ux) (- maxCos 1.0)))
maxCos)
ux)))
(*
(sin (* (* uy 2.0) (PI)))
(sqrt (- (* (- 2.0 ux) ux) (* (* (fma -2.0 ux 2.0) ux) maxCos))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.0003319999959785491:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\left(\left(1 - \left(maxCos - 1\right)\right) + \left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\sin \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}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 3.31999996e-4Initial program 60.7%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3260.7
Applied rewrites60.7%
Taylor expanded in maxCos around 0
lower--.f3258.5
Applied rewrites58.5%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites21.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-+r+N/A
lower-+.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f32N/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3298.3
Applied rewrites98.3%
if 3.31999996e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 55.0%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3255.1
lift-*.f32N/A
*-commutativeN/A
lower-*.f3255.1
Applied rewrites55.1%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3254.6
Applied rewrites54.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
lower-*.f3297.8
Applied rewrites97.8%
Taylor expanded in maxCos around 0
Applied rewrites74.6%
Final simplification89.4%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* uy 2.0) 0.0003319999959785491)
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(-
(+ (- 1.0 (- maxCos 1.0)) (* (* (- 1.0 maxCos) ux) (- maxCos 1.0)))
maxCos)
ux)))
(*
(sin (* (* uy 2.0) (PI)))
(sqrt (* (- (- 2.0 (* (fma -2.0 ux 2.0) maxCos)) ux) ux)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.0003319999959785491:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\left(\left(1 - \left(maxCos - 1\right)\right) + \left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(2 - \mathsf{fma}\left(-2, ux, 2\right) \cdot maxCos\right) - ux\right) \cdot ux}\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 3.31999996e-4Initial program 60.7%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3260.7
Applied rewrites60.7%
Taylor expanded in maxCos around 0
lower--.f3258.5
Applied rewrites58.5%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites21.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-+r+N/A
lower-+.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f32N/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3298.3
Applied rewrites98.3%
if 3.31999996e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 55.0%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3255.1
lift-*.f32N/A
*-commutativeN/A
lower-*.f3255.1
Applied rewrites55.1%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3254.6
Applied rewrites54.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
lower-*.f3297.8
Applied rewrites97.8%
Taylor expanded in maxCos around 0
Applied rewrites74.6%
Final simplification89.4%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* uy 2.0) 0.00039999998989515007)
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(-
(+ (- 1.0 (- maxCos 1.0)) (* (* (- 1.0 maxCos) ux) (- maxCos 1.0)))
maxCos)
ux)))
(* (sin (* (* uy 2.0) (PI))) (sqrt (* (- 2.0 ux) ux)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.00039999998989515007:\\
\;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\left(\left(1 - \left(maxCos - 1\right)\right) + \left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(2 - ux\right) \cdot ux}\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 3.9999999e-4Initial program 59.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3259.9
Applied rewrites59.9%
Taylor expanded in maxCos around 0
lower--.f3257.7
Applied rewrites57.7%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites20.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-+r+N/A
lower-+.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f32N/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3298.2
Applied rewrites98.2%
if 3.9999999e-4 < (*.f32 uy #s(literal 2 binary32)) Initial program 56.2%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3256.3
lift-*.f32N/A
*-commutativeN/A
lower-*.f3256.3
Applied rewrites56.3%
Taylor expanded in maxCos around inf
*-commutativeN/A
lower-*.f32N/A
associate--l+N/A
div-subN/A
lower-+.f32N/A
sub-negN/A
mul-1-negN/A
lower-/.f32N/A
mul-1-negN/A
sub-negN/A
lower--.f3255.9
Applied rewrites55.9%
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
lower-*.f3297.8
Applied rewrites97.8%
Taylor expanded in maxCos around 0
Applied rewrites88.0%
Final simplification94.5%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (* (* (PI) 2.0) uy)))
(if (<= t_0 0.9998199939727783)
(* t_1 (sqrt (- 1.0 (* t_0 t_0))))
(* t_1 (sqrt (* (- (- 1.0 (- maxCos 1.0)) maxCos) ux))))))\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}\;t\_0 \leq 0.9998199939727783:\\
\;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(\left(1 - \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}\\
\end{array}
\end{array}
if (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) < 0.999819994Initial program 90.2%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.8
Applied rewrites77.8%
if 0.999819994 < (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) Initial program 37.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3235.0
Applied rewrites35.0%
Taylor expanded in maxCos around 0
lower--.f3234.5
Applied rewrites34.5%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites17.3%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f3277.2
Applied rewrites77.2%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (* (* (PI) 2.0) uy)))
(if (<= t_0 0.9998199939727783)
(* t_1 (sqrt (- 1.0 (* t_0 (- 1.0 ux)))))
(* t_1 (sqrt (* (- (- 1.0 (- maxCos 1.0)) maxCos) ux))))))\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}\;t\_0 \leq 0.9998199939727783:\\
\;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(\left(1 - \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}\\
\end{array}
\end{array}
if (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) < 0.999819994Initial program 90.2%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3277.8
Applied rewrites77.8%
Taylor expanded in maxCos around 0
lower--.f3274.3
Applied rewrites74.3%
if 0.999819994 < (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) Initial program 37.9%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3235.0
Applied rewrites35.0%
Taylor expanded in maxCos around 0
lower--.f3234.5
Applied rewrites34.5%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites17.3%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f3277.2
Applied rewrites77.2%
(FPCore (ux uy maxCos)
:precision binary32
(*
(* (* (PI) 2.0) uy)
(sqrt
(*
(-
(+ (- 1.0 (- maxCos 1.0)) (* (* (- 1.0 maxCos) ux) (- maxCos 1.0)))
maxCos)
ux))))\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\left(\left(1 - \left(maxCos - 1\right)\right) + \left(\left(1 - maxCos\right) \cdot ux\right) \cdot \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}
\end{array}
Initial program 58.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3251.9
Applied rewrites51.9%
Taylor expanded in maxCos around 0
lower--.f3250.2
Applied rewrites50.2%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites20.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
associate-+r+N/A
lower-+.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f32N/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
lower--.f3282.0
Applied rewrites82.0%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* (PI) 2.0) uy) (sqrt (* (- (- 1.0 (- maxCos 1.0)) maxCos) ux))))
\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\left(\left(1 - \left(maxCos - 1\right)\right) - maxCos\right) \cdot ux}
\end{array}
Initial program 58.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3251.9
Applied rewrites51.9%
Taylor expanded in maxCos around 0
lower--.f3250.2
Applied rewrites50.2%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites20.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower--.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower--.f3265.8
Applied rewrites65.8%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* (PI) 2.0) uy) (sqrt (fma (- ux 1.0) (- 1.0 ux) 1.0))))
\begin{array}{l}
\\
\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\mathsf{fma}\left(ux - 1, 1 - ux, 1\right)}
\end{array}
Initial program 58.6%
Taylor expanded in uy around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3251.9
Applied rewrites51.9%
Taylor expanded in maxCos around 0
lower--.f3250.2
Applied rewrites50.2%
lift--.f32N/A
sub-negN/A
+-commutativeN/A
lift-*.f32N/A
lift-+.f32N/A
lift--.f32N/A
lift-*.f32N/A
distribute-rgt-neg-inN/A
lower-fma.f32N/A
Applied rewrites20.2%
Taylor expanded in maxCos around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
lower--.f32N/A
lower--.f3220.2
Applied rewrites20.2%
herbie shell --seed 2024307
(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)))))))