
(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 20 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 (sqrt (- 1.0 (* t_0 t_0)))))
(-
(+
(* yi (* (sin (* (PI) (* uy 2.0))) t_1))
(* xi (* t_1 (cos (* (cbrt (PI)) (* (cbrt (* (PI) (PI))) (* uy 2.0)))))))
(* (* (- 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 := \sqrt{1 - t\_0 \cdot t\_0}\\
\left(yi \cdot \left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right) \cdot t\_1\right) + xi \cdot \left(t\_1 \cdot \cos \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)} \cdot \left(uy \cdot 2\right)\right)\right)\right)\right) - \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
lift-*.f32N/A
lift-*.f32N/A
lift-PI.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-PI.f32N/A
rem-cube-cbrtN/A
lift-cbrt.f32N/A
pow3N/A
unpow2N/A
lift-pow.f32N/A
associate-*l*N/A
lift-*.f32N/A
lift-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-cbrt.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3298.9
Applied rewrites98.9%
Final simplification98.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux))
(t_1 (sqrt (- 1.0 (* t_0 t_0))))
(t_2 (* (PI) (* uy 2.0))))
(-
(+ (* (* (cos t_2) t_1) xi) (* yi (* (sin t_2) 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 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + yi \cdot \left(\sin t\_2 \cdot t\_1\right)\right) - \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Final simplification98.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (PI) (* uy 2.0)))
(t_1 (* (* maxCos (- 1.0 ux)) ux))
(t_2 (sqrt (- 1.0 (* t_1 t_1)))))
(+
(* (* (- maxCos (* maxCos ux)) ux) zi)
(+ (* (* (cos t_0) t_2) xi) (* yi (* (sin t_0) t_2))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\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(\cos t\_0 \cdot t\_2\right) \cdot xi + yi \cdot \left(\sin t\_0 \cdot t\_2\right)\right)
\end{array}
\end{array}
Initial program 98.8%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.8
Applied rewrites98.8%
Final simplification98.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (sin (* (* (PI) uy) 2.0)) yi)
(* (* (cos (* (PI) (* uy 2.0))) (sqrt (- 1.0 (* t_0 t_0)))) xi))
(* (* (* (- 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 + \left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right) \cdot xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.8
Applied rewrites98.8%
Final simplification98.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (cos (* (* (PI) uy) 2.0)) xi)
(* yi (* (sin (* (PI) (* uy 2.0))) (sqrt (- 1.0 (* t_0 t_0))))))
(* (* (- 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 + yi \cdot \left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right)\right) - \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in maxCos around 0
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (PI) (* uy 2.0))))
(+
(* (* (- maxCos (* maxCos ux)) ux) zi)
(+ (* yi (sin t_0)) (* (cos t_0) xi)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\\
\left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi + \left(yi \cdot \sin t\_0 + \cos t\_0 \cdot xi\right)
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.4
Applied rewrites98.4%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3228.6
Applied rewrites28.6%
Applied rewrites98.6%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3298.6
Applied rewrites98.6%
Final simplification98.6%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (let* ((t_0 (* (PI) (* uy 2.0)))) (+ (* (* maxCos ux) zi) (+ (* yi (sin t_0)) (* (cos t_0) xi)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\\
\left(maxCos \cdot ux\right) \cdot zi + \left(yi \cdot \sin t\_0 + \cos t\_0 \cdot xi\right)
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.4
Applied rewrites98.4%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3228.6
Applied rewrites28.6%
Applied rewrites98.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f3295.6
Applied rewrites95.6%
Final simplification95.6%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (+ (* (* (* yi (PI)) uy) 2.0) (* (cos (* (PI) (* uy 2.0))) xi)) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 + \cos \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right) \cdot xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.4
Applied rewrites98.4%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3228.6
Applied rewrites28.6%
Applied rewrites98.6%
Taylor expanded in uy around 0
Applied rewrites88.6%
Final simplification88.6%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0)) (t_1 (* (cos t_0) xi)))
(if (<= xi -1.9999999774532045e-26)
(+ t_1 (* (* (- maxCos (* maxCos ux)) ux) zi))
(if (<= xi 6.000000068087077e-19)
(- (* (sin t_0) yi) (* (* (* (- ux 1.0) maxCos) ux) zi))
(- t_1 (* (* (- ux 1.0) (* maxCos ux)) zi))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
t_1 := \cos t\_0 \cdot xi\\
\mathbf{if}\;xi \leq -1.9999999774532045 \cdot 10^{-26}:\\
\;\;\;\;t\_1 + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\mathbf{elif}\;xi \leq 6.000000068087077 \cdot 10^{-19}:\\
\;\;\;\;\sin t\_0 \cdot yi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\\
\end{array}
\end{array}
if xi < -1.99999998e-26Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3215.0
Applied rewrites15.0%
Taylor expanded in xi around inf
Applied rewrites79.6%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3279.6
Applied rewrites79.6%
if -1.99999998e-26 < xi < 6.00000007e-19Initial program 98.6%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3297.8
Applied rewrites97.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3250.7
Applied rewrites50.7%
Taylor expanded in xi around 0
Applied rewrites77.7%
if 6.00000007e-19 < xi Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3211.8
Applied rewrites11.8%
Taylor expanded in xi around inf
Applied rewrites81.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-*.f32N/A
lift-*.f3281.9
Applied rewrites81.9%
Final simplification79.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0)) (t_1 (* (cos t_0) xi)))
(if (<= xi -1.9999999774532045e-26)
(+ t_1 (* (* (- maxCos (* maxCos ux)) ux) zi))
(if (<= xi 6.000000068087077e-19)
(* (sin t_0) yi)
(- t_1 (* (* (- ux 1.0) (* maxCos ux)) zi))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
t_1 := \cos t\_0 \cdot xi\\
\mathbf{if}\;xi \leq -1.9999999774532045 \cdot 10^{-26}:\\
\;\;\;\;t\_1 + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\mathbf{elif}\;xi \leq 6.000000068087077 \cdot 10^{-19}:\\
\;\;\;\;\sin t\_0 \cdot yi\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\\
\end{array}
\end{array}
if xi < -1.99999998e-26Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3215.0
Applied rewrites15.0%
Taylor expanded in xi around inf
Applied rewrites79.6%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3279.6
Applied rewrites79.6%
if -1.99999998e-26 < xi < 6.00000007e-19Initial program 98.6%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites5.6%
Taylor expanded in maxCos around 0
Applied rewrites66.5%
if 6.00000007e-19 < xi Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3211.8
Applied rewrites11.8%
Taylor expanded in xi around inf
Applied rewrites81.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-*.f32N/A
lift-*.f3281.9
Applied rewrites81.9%
Final simplification74.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0))
(t_1 (+ (* (cos t_0) xi) (* (* (- maxCos (* maxCos ux)) ux) zi))))
(if (<= xi -1.9999999774532045e-26)
t_1
(if (<= xi 6.000000068087077e-19) (* (sin t_0) yi) t_1))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
t_1 := \cos t\_0 \cdot xi + \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -1.9999999774532045 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;xi \leq 6.000000068087077 \cdot 10^{-19}:\\
\;\;\;\;\sin t\_0 \cdot yi\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if xi < -1.99999998e-26 or 6.00000007e-19 < xi Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3213.5
Applied rewrites13.5%
Taylor expanded in xi around inf
Applied rewrites80.6%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3280.6
Applied rewrites80.6%
if -1.99999998e-26 < xi < 6.00000007e-19Initial program 98.6%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites6.2%
Taylor expanded in maxCos around 0
Applied rewrites66.5%
Final simplification74.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0))
(t_1 (+ (* (cos t_0) xi) (* (* maxCos ux) zi))))
(if (<= xi -1.9999999774532045e-26)
t_1
(if (<= xi 6.000000068087077e-19) (* (sin t_0) yi) t_1))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
t_1 := \cos t\_0 \cdot xi + \left(maxCos \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -1.9999999774532045 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;xi \leq 6.000000068087077 \cdot 10^{-19}:\\
\;\;\;\;\sin t\_0 \cdot yi\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if xi < -1.99999998e-26 or 6.00000007e-19 < xi Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3213.5
Applied rewrites13.5%
Taylor expanded in xi around inf
Applied rewrites80.6%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f3279.1
Applied rewrites79.1%
if -1.99999998e-26 < xi < 6.00000007e-19Initial program 98.6%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites6.3%
Taylor expanded in maxCos around 0
Applied rewrites66.5%
Final simplification74.0%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(-
(fma
(fma (* (* xi (* (PI) (PI))) uy) -2.0 (* (* yi (PI)) 2.0))
uy
xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))))
(if (<= xi -1.9999999774532045e-26)
t_0
(if (<= xi 6.000000068087077e-19) (* (sin (* (* (PI) uy) 2.0)) yi) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -1.9999999774532045 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;xi \leq 6.000000068087077 \cdot 10^{-19}:\\
\;\;\;\;\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 < -1.99999998e-26 or 6.00000007e-19 < xi Initial program 99.0%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.8
Applied rewrites98.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3213.5
Applied rewrites13.5%
Taylor expanded in xi around inf
Applied rewrites80.6%
Taylor expanded in uy around 0
Applied rewrites62.2%
if -1.99999998e-26 < xi < 6.00000007e-19Initial program 98.6%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites6.3%
Taylor expanded in maxCos around 0
Applied rewrites66.5%
Final simplification52.1%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(*
(* (* (* (PI) uy) 2.0) yi)
(sqrt (fma (* (- ux) ux) (* maxCos maxCos) 1.0)))))
(if (<= yi -2.9999999050033628e-15)
t_0
(if (<= yi 8.000000106811456e-10)
(-
(fma (fma (* (* xi (* (PI) (PI))) uy) -2.0 (* (* yi (PI)) 2.0)) uy xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right) \cdot \sqrt{\mathsf{fma}\left(\left(-ux\right) \cdot ux, maxCos \cdot maxCos, 1\right)}\\
\mathbf{if}\;yi \leq -2.9999999050033628 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 8.000000106811456 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -2.99999991e-15 or 8.00000011e-10 < yi Initial program 99.0%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites4.8%
Taylor expanded in ux around 0
Applied rewrites31.9%
Taylor expanded in uy around 0
Applied rewrites52.2%
if -2.99999991e-15 < yi < 8.00000011e-10Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.5
Applied rewrites98.5%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3219.7
Applied rewrites19.7%
Taylor expanded in xi around inf
Applied rewrites76.5%
Taylor expanded in uy around 0
Applied rewrites66.4%
Final simplification62.3%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(*
(* (* (* (PI) uy) 2.0) yi)
(sqrt (fma (* (- ux) ux) (* maxCos maxCos) 1.0)))))
(if (<= yi -2.9999999050033628e-15)
t_0
(if (<= yi 8.000000106811456e-10)
(-
(fma (* (* uy uy) -2.0) (* xi (* (PI) (PI))) xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right) \cdot \sqrt{\mathsf{fma}\left(\left(-ux\right) \cdot ux, maxCos \cdot maxCos, 1\right)}\\
\mathbf{if}\;yi \leq -2.9999999050033628 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 8.000000106811456 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -2.99999991e-15 or 8.00000011e-10 < yi Initial program 99.0%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites4.8%
Taylor expanded in ux around 0
Applied rewrites29.2%
Taylor expanded in uy around 0
Applied rewrites54.6%
if -2.99999991e-15 < yi < 8.00000011e-10Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.5
Applied rewrites98.5%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3219.7
Applied rewrites19.7%
Taylor expanded in xi around inf
Applied rewrites76.5%
Taylor expanded in uy around 0
Applied rewrites65.8%
Final simplification62.3%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(*
(* (* (* yi (PI)) uy) 2.0)
(sqrt (fma (* (- ux) ux) (* maxCos maxCos) 1.0)))))
(if (<= yi -2.9999999050033628e-15)
t_0
(if (<= yi 8.000000106811456e-10)
(-
(fma (* (* uy uy) -2.0) (* xi (* (PI) (PI))) xi)
(* (* (* (- ux 1.0) maxCos) ux) zi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\mathsf{fma}\left(\left(-ux\right) \cdot ux, maxCos \cdot maxCos, 1\right)}\\
\mathbf{if}\;yi \leq -2.9999999050033628 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 8.000000106811456 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -2.99999991e-15 or 8.00000011e-10 < yi Initial program 99.0%
Taylor expanded in yi around inf
*-commutativeN/A
lower-*.f32N/A
Applied rewrites4.8%
Taylor expanded in ux around 0
Applied rewrites29.1%
Taylor expanded in uy around 0
Applied rewrites53.9%
if -2.99999991e-15 < yi < 8.00000011e-10Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.5
Applied rewrites98.5%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3219.7
Applied rewrites19.7%
Taylor expanded in xi around inf
Applied rewrites76.5%
Taylor expanded in uy around 0
Applied rewrites64.6%
Final simplification62.2%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (fma (* (* uy uy) -2.0) (* xi (* (PI) (PI))) xi) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.4
Applied rewrites98.4%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3228.6
Applied rewrites28.6%
Taylor expanded in xi around inf
Applied rewrites59.4%
Taylor expanded in uy around 0
Applied rewrites51.9%
Final simplification28.3%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (fma (* (* yi (PI)) uy) 2.0 xi) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy, 2, xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.8%
lift-*.f32N/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.4
Applied rewrites98.4%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-fma.f32N/A
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3228.6
Applied rewrites28.6%
Applied rewrites98.6%
Taylor expanded in uy around 0
Applied rewrites51.9%
Final simplification50.2%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi (* maxCos (- 1.0 ux))) ux))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return (zi * (maxCos * (1.0f - ux))) * ux;
}
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 * (maxcos * (1.0e0 - ux))) * ux
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(zi * Float32(maxCos * Float32(Float32(1.0) - ux))) * ux) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = (zi * (maxCos * (single(1.0) - ux))) * ux; end
\begin{array}{l}
\\
\left(zi \cdot \left(maxCos \cdot \left(1 - ux\right)\right)\right) \cdot ux
\end{array}
Initial program 98.8%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3213.0
Applied rewrites13.0%
Applied rewrites13.0%
(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.8%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3213.0
Applied rewrites13.0%
Taylor expanded in ux around 0
Applied rewrites11.4%
herbie shell --seed 2024277
(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)))