
(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 12 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 (* (sqrt (* (- 2.0 (- (* (pow (- maxCos 1.0) 2.0) ux) (* -2.0 maxCos))) ux)) (cos (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(2 - \left({\left(maxCos - 1\right)}^{2} \cdot ux - -2 \cdot maxCos\right)\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 57.2%
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.2
Applied rewrites2.8%
Applied rewrites98.9%
Final simplification98.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (cos (* (PI) (* 2.0 uy)))))
(if (<= maxCos 9.99999993922529e-9)
(* (sqrt (* (- 2.0 ux) ux)) t_0)
(*
(sqrt
(*
(* maxCos maxCos)
(-
(*
(+
(/ (- 2.0 (/ 2.0 ux)) maxCos)
(/ (/ (- (/ 2.0 ux) 1.0) maxCos) maxCos))
(* ux ux))
(* ux ux))))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\mathbf{if}\;maxCos \leq 9.99999993922529 \cdot 10^{-9}:\\
\;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(\left(\frac{2 - \frac{2}{ux}}{maxCos} + \frac{\frac{\frac{2}{ux} - 1}{maxCos}}{maxCos}\right) \cdot \left(ux \cdot ux\right) - ux \cdot ux\right)} \cdot t\_0\\
\end{array}
\end{array}
if maxCos < 9.99999994e-9Initial program 56.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--.f320.7
Applied rewrites2.2%
Taylor expanded in maxCos around 0
Applied rewrites99.1%
if 9.99999994e-9 < maxCos Initial program 61.4%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3247.0
Applied rewrites47.0%
Applied rewrites98.6%
Taylor expanded in maxCos around inf
Applied rewrites98.1%
Final simplification98.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (cos (* (PI) (* 2.0 uy)))))
(if (<= maxCos 8.599999823388771e-9)
(* (sqrt (* (- 2.0 ux) ux)) t_0)
(*
(sqrt
(*
(*
(- (/ (- (* ux 2.0) (- 2.0 (/ (- 2.0 ux) maxCos))) maxCos) ux)
(* maxCos maxCos))
ux))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\mathbf{if}\;maxCos \leq 8.599999823388771 \cdot 10^{-9}:\\
\;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\left(\frac{ux \cdot 2 - \left(2 - \frac{2 - ux}{maxCos}\right)}{maxCos} - ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot ux} \cdot t\_0\\
\end{array}
\end{array}
if maxCos < 8.59999982e-9Initial program 56.3%
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--.f320.7
Applied rewrites1.2%
Taylor expanded in maxCos around 0
Applied rewrites99.1%
if 8.59999982e-9 < maxCos Initial program 60.4%
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--.f327.6
Applied rewrites7.6%
Taylor expanded in maxCos around -inf
Applied rewrites98.0%
Final simplification98.9%
(FPCore (ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.003000000026077032)
(*
(sqrt (* (- (/ 2.0 ux) 1.0) (* ux ux)))
(fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0))
(* (sqrt (* ux 2.0)) (cos (* (PI) (* 2.0 uy))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.003000000026077032:\\
\;\;\;\;\sqrt{\left(\frac{2}{ux} - 1\right) \cdot \left(ux \cdot ux\right)} \cdot \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{ux \cdot 2} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 0.00300000003Initial program 56.5%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3292.4
Applied rewrites92.4%
Taylor expanded in maxCos around 0
Applied rewrites94.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.f3291.7
Applied rewrites91.1%
if 0.00300000003 < (*.f32 uy #s(literal 2 binary32)) Initial program 58.8%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3211.2
Applied rewrites11.2%
Taylor expanded in maxCos around 0
Applied rewrites92.9%
Taylor expanded in ux around 0
Applied rewrites73.7%
Final simplification86.2%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- 2.0 ux) ux)) (cos (* (PI) (* 2.0 uy)))))
\begin{array}{l}
\\
\sqrt{\left(2 - ux\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Initial program 57.2%
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.7
Applied rewrites2.6%
Taylor expanded in maxCos around 0
Applied rewrites93.9%
Final simplification93.9%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* uy uy) -2.0)) (t_1 (+ (* maxCos ux) (- 1.0 ux))))
(if (<= (- 1.0 (* t_1 t_1)) 0.0007999999797903001)
(* (sqrt (* (+ (* -2.0 maxCos) 2.0) ux)) (fma t_0 (* (PI) (PI)) 1.0))
(*
(sqrt (- 1.0 (* (- 1.0 ux) (- 1.0 (- ux (* maxCos ux))))))
(fma (* t_0 (PI)) (PI) 1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(uy \cdot uy\right) \cdot -2\\
t_1 := maxCos \cdot ux + \left(1 - ux\right)\\
\mathbf{if}\;1 - t\_1 \cdot t\_1 \leq 0.0007999999797903001:\\
\;\;\;\;\sqrt{\left(-2 \cdot maxCos + 2\right) \cdot ux} \cdot \mathsf{fma}\left(t\_0, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - ux\right) \cdot \left(1 - \left(ux - maxCos \cdot ux\right)\right)} \cdot \mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right)\\
\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)))) < 7.9999998e-4Initial program 37.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.f3232.2
Applied rewrites32.2%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.9
Applied rewrites70.9%
Applied rewrites73.3%
if 7.9999998e-4 < (-.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.4%
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.f3274.3
Applied rewrites73.4%
Applied rewrites73.4%
Taylor expanded in maxCos around 0
lower--.f3272.4
Applied rewrites71.4%
lift-+.f32N/A
lift--.f32N/A
associate-+l-N/A
lower--.f32N/A
lower--.f3272.4
Applied rewrites71.4%
Final simplification73.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* uy uy) -2.0)) (t_1 (+ (* maxCos ux) (- 1.0 ux))))
(if (<= (- 1.0 (* t_1 t_1)) 0.0007999999797903001)
(* (sqrt (* (+ (* -2.0 maxCos) 2.0) ux)) (fma t_0 (* (PI) (PI)) 1.0))
(* (sqrt (- 1.0 (* (- 1.0 ux) t_1))) (fma (* t_0 (PI)) (PI) 1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(uy \cdot uy\right) \cdot -2\\
t_1 := maxCos \cdot ux + \left(1 - ux\right)\\
\mathbf{if}\;1 - t\_1 \cdot t\_1 \leq 0.0007999999797903001:\\
\;\;\;\;\sqrt{\left(-2 \cdot maxCos + 2\right) \cdot ux} \cdot \mathsf{fma}\left(t\_0, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - ux\right) \cdot t\_1} \cdot \mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right)\\
\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)))) < 7.9999998e-4Initial program 37.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.f3232.2
Applied rewrites32.2%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.9
Applied rewrites70.9%
Applied rewrites73.3%
if 7.9999998e-4 < (-.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.4%
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.f3274.3
Applied rewrites73.4%
Applied rewrites73.4%
Taylor expanded in maxCos around 0
lower--.f3272.4
Applied rewrites71.4%
Applied rewrites71.4%
Final simplification73.0%
(FPCore (ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* uy uy) -2.0)) (t_1 (+ (* maxCos ux) (- 1.0 ux))))
(if (<= (- 1.0 (* t_1 t_1)) 0.0007999999797903001)
(* (sqrt (* (+ (* -2.0 maxCos) 2.0) ux)) (fma t_0 (* (PI) (PI)) 1.0))
(*
(sqrt (- 1.0 (* (- 1.0 ux) (- 1.0 ux))))
(fma (* t_0 (PI)) (PI) 1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(uy \cdot uy\right) \cdot -2\\
t_1 := maxCos \cdot ux + \left(1 - ux\right)\\
\mathbf{if}\;1 - t\_1 \cdot t\_1 \leq 0.0007999999797903001:\\
\;\;\;\;\sqrt{\left(-2 \cdot maxCos + 2\right) \cdot ux} \cdot \mathsf{fma}\left(t\_0, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)} \cdot \mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), 1\right)\\
\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)))) < 7.9999998e-4Initial program 37.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.f3232.2
Applied rewrites32.2%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3270.9
Applied rewrites70.3%
Applied rewrites72.7%
if 7.9999998e-4 < (-.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.4%
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.f3274.3
Applied rewrites73.4%
Applied rewrites73.4%
Taylor expanded in maxCos around 0
lower--.f3272.4
Applied rewrites71.4%
Taylor expanded in maxCos around 0
lower--.f3272.1
Applied rewrites72.1%
Final simplification72.9%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (- (/ 2.0 ux) 1.0) (* ux ux))) (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)))
\begin{array}{l}
\\
\sqrt{\left(\frac{2}{ux} - 1\right) \cdot \left(ux \cdot ux\right)} \cdot \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)
\end{array}
Initial program 57.2%
Taylor expanded in ux around inf
*-commutativeN/A
lower-*.f32N/A
associate--r+N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
div-subN/A
cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-pow.f32N/A
lower--.f32N/A
unpow2N/A
lower-*.f3267.7
Applied rewrites67.7%
Taylor expanded in maxCos around 0
Applied rewrites93.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.f3275.1
Applied rewrites74.8%
Final simplification75.1%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* (+ (* -2.0 maxCos) 2.0) ux)) (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)))
\begin{array}{l}
\\
\sqrt{\left(-2 \cdot maxCos + 2\right) \cdot ux} \cdot \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)
\end{array}
Initial program 57.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.f3247.9
Applied rewrites47.9%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3261.5
Applied rewrites61.5%
Applied rewrites63.2%
Final simplification63.3%
(FPCore (ux uy maxCos) :precision binary32 (* (sqrt (* 2.0 ux)) (fma uy (* (* -2.0 uy) (* (PI) (PI))) 1.0)))
\begin{array}{l}
\\
\sqrt{2 \cdot ux} \cdot \mathsf{fma}\left(uy, \left(-2 \cdot uy\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 1\right)
\end{array}
Initial program 57.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.f3247.9
Applied rewrites47.5%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3261.5
Applied rewrites61.5%
Taylor expanded in maxCos around 0
Applied rewrites61.4%
Applied rewrites61.4%
Final simplification61.5%
(FPCore (ux uy maxCos) :precision binary32 (* (* (* (* (* uy uy) -2.0) (PI)) (PI)) (sqrt (* 2.0 ux))))
\begin{array}{l}
\\
\left(\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{2 \cdot ux}
\end{array}
Initial program 57.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.f3247.9
Applied rewrites47.5%
Taylor expanded in ux around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f3261.5
Applied rewrites61.4%
Taylor expanded in maxCos around 0
Applied rewrites61.4%
Taylor expanded in uy around inf
Applied rewrites5.3%
herbie shell --seed 2024332
(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)))))))