
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- 1.0 ux) maxCos) ux))
(t_1 (sqrt (- 1.0 (* t_0 t_0))))
(t_2 (* (* uy 2.0) (PI))))
(+ (+ (* (* (cos t_2) t_1) xi) (* (* (sin t_2) t_1) yi)) (* t_0 zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- 1.0 ux) maxCos) ux))
(t_1 (sqrt (- 1.0 (* t_0 t_0))))
(t_2 (* (* uy 2.0) (PI))))
(+ (+ (* (* (cos t_2) t_1) xi) (* (* (sin t_2) t_1) yi)) (* t_0 zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi
\end{array}
\end{array}
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)) (t_1 (* (* 2.0 uy) (PI))))
(-
(+
(* (sin t_1) (* (sqrt (- 1.0 (pow t_0 2.0))) yi))
(* xi (* (sqrt (- 1.0 (* t_0 t_0))) (cos t_1))))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
t_1 := \left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\\
\left(\sin t\_1 \cdot \left(\sqrt{1 - {t\_0}^{2}} \cdot yi\right) + xi \cdot \left(\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos t\_1\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.7%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites98.7%
Final simplification98.7%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* 2.0 uy) (PI)))
(t_1 (* (* maxCos (- 1.0 ux)) ux))
(t_2 (sqrt (- 1.0 (* t_1 t_1)))))
(+
(* (* (- maxCos (* maxCos ux)) ux) zi)
(+ (* (* (sin t_0) t_2) yi) (* xi (* t_2 (cos t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
t_2 := \sqrt{1 - t\_1 \cdot t\_1}\\
\left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi + \left(\left(\sin t\_0 \cdot t\_2\right) \cdot yi + xi \cdot \left(t\_2 \cdot \cos t\_0\right)\right)
\end{array}
\end{array}
Initial program 98.7%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (sin (* (* (PI) uy) 2.0)) yi)
(* xi (* (sqrt (- 1.0 (* t_0 t_0))) (cos (* (* 2.0 uy) (PI))))))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi + xi \cdot \left(\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.7%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.5
Applied rewrites98.5%
Final simplification98.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(+
(+
(* (cos (* (* (PI) uy) 2.0)) xi)
(* (* (sin (* (* 2.0 uy) (PI))) (sqrt (- 1.0 (* t_0 t_0)))) yi))
(* (* (- maxCos (* maxCos ux)) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot xi + \left(\sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right) \cdot yi\right) + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.7%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.7
Applied rewrites98.7%
Taylor expanded in ux around 0
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.4
Applied rewrites98.4%
Final simplification98.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (cos (* (* (PI) uy) 2.0)) xi)
(* (* (sin (* (* 2.0 uy) (PI))) (sqrt (- 1.0 (* t_0 t_0)))) yi))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot xi + \left(\sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right) \cdot yi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.7%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.4
Applied rewrites98.4%
Final simplification98.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* ux ux) (pow (- 1.0 ux) 2.0)))
(t_1 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= xi -5.0000000843119176e-17)
(- (* (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0))) xi) t_1)
(if (<= xi 1.9999999920083944e-11)
(-
(*
(sqrt (fma (* (- maxCos) maxCos) t_0 1.0))
(* (sin (* (* (PI) uy) 2.0)) yi))
t_1)
(+
(* (sqrt (- 1.0 (* (* maxCos maxCos) t_0))) xi)
(* (* (- maxCos (* maxCos ux)) ux) zi))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(ux \cdot ux\right) \cdot {\left(1 - ux\right)}^{2}\\
t_1 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}} \cdot xi - t\_1\\
\mathbf{elif}\;xi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\left(-maxCos\right) \cdot maxCos, t\_0, 1\right)} \cdot \left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(maxCos \cdot maxCos\right) \cdot t\_0} \cdot xi + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\end{array}
\end{array}
if xi < -5.00000008e-17Initial program 99.2%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3299.2
Applied rewrites99.2%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites7.3%
Applied rewrites63.5%
if -5.00000008e-17 < xi < 1.99999999e-11Initial program 98.5%
Taylor expanded in xi around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites9.5%
if 1.99999999e-11 < xi Initial program 98.7%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
Taylor expanded in uy around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites66.6%
Final simplification31.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0)))))
(if (<= xi -5.0000000843119176e-17)
(- (* t_1 xi) t_0)
(if (<= xi 1.9999999920083944e-11)
(- (* (sin (* (* 2.0 uy) (PI))) (* t_1 yi)) t_0)
(+
(*
(sqrt
(- 1.0 (* (* maxCos maxCos) (* (* ux ux) (pow (- 1.0 ux) 2.0)))))
xi)
(* (* (- maxCos (* maxCos ux)) ux) zi))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_1 := \sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}}\\
\mathbf{if}\;xi \leq -5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;t\_1 \cdot xi - t\_0\\
\mathbf{elif}\;xi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(t\_1 \cdot yi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot {\left(1 - ux\right)}^{2}\right)} \cdot xi + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\end{array}
\end{array}
if xi < -5.00000008e-17Initial program 99.2%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3299.2
Applied rewrites99.2%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites7.3%
Applied rewrites63.5%
if -5.00000008e-17 < xi < 1.99999999e-11Initial program 98.5%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites9.6%
Applied rewrites69.5%
if 1.99999999e-11 < xi Initial program 98.7%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
Taylor expanded in uy around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites66.6%
Final simplification67.6%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (sin (* (* (PI) uy) 2.0)) yi)))
(if (<= yi -1.999999936531045e-19)
t_0
(if (<= yi 4.99999991225835e-15)
(+
(*
(sqrt
(- 1.0 (* (* maxCos maxCos) (* (* ux ux) (pow (- 1.0 ux) 2.0)))))
xi)
(* (* (- maxCos (* maxCos ux)) ux) zi))
(*
(sqrt (- 1.0 (* (* (fma -2.0 ux 1.0) (* ux ux)) (* maxCos maxCos))))
t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\\
\mathbf{if}\;yi \leq -1.999999936531045 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 4.99999991225835 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{1 - \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot {\left(1 - ux\right)}^{2}\right)} \cdot xi + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\mathsf{fma}\left(-2, ux, 1\right) \cdot \left(ux \cdot ux\right)\right) \cdot \left(maxCos \cdot maxCos\right)} \cdot t\_0\\
\end{array}
\end{array}
if yi < -1.99999994e-19Initial program 98.7%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites5.8%
Taylor expanded in ux around 0
Applied rewrites66.1%
if -1.99999994e-19 < yi < 4.99999991e-15Initial program 98.9%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites66.2%
if 4.99999991e-15 < yi Initial program 98.4%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites6.7%
Taylor expanded in yi around inf
Applied rewrites66.3%
Taylor expanded in ux around 0
Applied rewrites62.6%
Final simplification66.2%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (sin (* (* (PI) uy) 2.0)) yi)))
(if (<= yi -1.999999936531045e-19)
t_0
(if (<= yi 4.99999991225835e-15)
(-
(* (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0))) xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))
(*
(sqrt (- 1.0 (* (* (fma -2.0 ux 1.0) (* ux ux)) (* maxCos maxCos))))
t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\\
\mathbf{if}\;yi \leq -1.999999936531045 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 4.99999991225835 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}} \cdot xi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left(\mathsf{fma}\left(-2, ux, 1\right) \cdot \left(ux \cdot ux\right)\right) \cdot \left(maxCos \cdot maxCos\right)} \cdot t\_0\\
\end{array}
\end{array}
if yi < -1.99999994e-19Initial program 98.7%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites5.9%
Taylor expanded in ux around 0
Applied rewrites66.1%
if -1.99999994e-19 < yi < 4.99999991e-15Initial program 98.9%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites17.3%
Applied rewrites66.2%
if 4.99999991e-15 < yi Initial program 98.4%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites6.8%
Taylor expanded in yi around inf
Applied rewrites66.3%
Taylor expanded in ux around 0
Applied rewrites62.6%
Final simplification66.2%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (sin (* (* (PI) uy) 2.0)) yi)))
(if (<= yi -1.999999936531045e-19)
t_0
(if (<= yi 4.99999991225835e-15)
(-
(* (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0))) xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\\
\mathbf{if}\;yi \leq -1.999999936531045 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 4.99999991225835 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}} \cdot xi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -1.99999994e-19 or 4.99999991e-15 < yi Initial program 98.6%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites6.2%
Taylor expanded in ux around 0
Applied rewrites66.2%
if -1.99999994e-19 < yi < 4.99999991e-15Initial program 98.9%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites17.3%
Applied rewrites66.2%
Final simplification66.2%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(fma
ux
(* (* zi (- 1.0 ux)) maxCos)
(* (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0))) xi))))
(if (<= xi -4.99999991225835e-14)
t_0
(if (<= xi 1.9999999920083944e-11)
(* (sin (* (* (PI) uy) 2.0)) yi)
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(ux, \left(zi \cdot \left(1 - ux\right)\right) \cdot maxCos, \sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}} \cdot xi\right)\\
\mathbf{if}\;xi \leq -4.99999991225835 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;xi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if xi < -4.99999991e-14 or 1.99999999e-11 < xi Initial program 99.0%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites7.4%
Applied rewrites65.6%
if -4.99999991e-14 < xi < 1.99999999e-11Initial program 98.6%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites9.4%
Taylor expanded in ux around 0
Applied rewrites59.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (fma (* zi ux) maxCos xi)))
(if (<= xi -4.99999991225835e-14)
t_0
(if (<= xi 1.9999999920083944e-11)
(* (sin (* (* (PI) uy) 2.0)) yi)
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(zi \cdot ux, maxCos, xi\right)\\
\mathbf{if}\;xi \leq -4.99999991225835 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;xi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if xi < -4.99999991e-14 or 1.99999999e-11 < xi Initial program 99.0%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites7.4%
Taylor expanded in ux around 0
Applied rewrites65.6%
if -4.99999991e-14 < xi < 1.99999999e-11Initial program 98.6%
Taylor expanded in xi around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites9.3%
Taylor expanded in ux around 0
Applied rewrites59.8%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (fma (* zi ux) maxCos xi))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return fmaf((zi * ux), maxCos, xi);
}
function code(xi, yi, zi, ux, uy, maxCos) return fma(Float32(zi * ux), maxCos, xi) end
\begin{array}{l}
\\
\mathsf{fma}\left(zi \cdot ux, maxCos, xi\right)
\end{array}
Initial program 98.7%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3298.7
Applied rewrites98.7%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites12.7%
Taylor expanded in ux around 0
Applied rewrites39.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi ux) maxCos))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return (zi * ux) * maxCos;
}
real(4) function code(xi, yi, zi, ux, uy, maxcos)
real(4), intent (in) :: xi
real(4), intent (in) :: yi
real(4), intent (in) :: zi
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = (zi * ux) * maxcos
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(zi * ux) * maxCos) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = (zi * ux) * maxCos; end
\begin{array}{l}
\\
\left(zi \cdot ux\right) \cdot maxCos
\end{array}
Initial program 98.7%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3212.7
Applied rewrites12.7%
Taylor expanded in ux around 0
Applied rewrites11.6%
herbie shell --seed 2024295
(FPCore (xi yi zi ux uy maxCos)
:name "UniformSampleCone 2"
:precision binary32
:pre (and (and (and (and (and (and (<= -10000.0 xi) (<= xi 10000.0)) (and (<= -10000.0 yi) (<= yi 10000.0))) (and (<= -10000.0 zi) (<= zi 10000.0))) (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) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) xi) (* (* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) yi)) (* (* (* (- 1.0 ux) maxCos) ux) zi)))