
(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 (* (PI) uy)) (t_1 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (cos t_0) (* (* (sin t_0) 2.0) yi))
(* xi (* (cos (* (* 2.0 uy) (PI))) (sqrt (- 1.0 (* t_1 t_1))))))
(* (* (* (- ux 1.0) maxCos) zi) ux))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot uy\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\cos t\_0 \cdot \left(\left(\sin t\_0 \cdot 2\right) \cdot yi\right) + xi \cdot \left(\cos \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_1 \cdot t\_1}\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
Applied rewrites98.9%
Applied rewrites99.0%
Final simplification99.0%
(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 (* (* 2.0 uy) (PI))))
(-
(+ (* (* (sin t_2) t_1) yi) (* xi (* (cos 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 := \left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\\
\left(\left(\sin t\_2 \cdot t\_1\right) \cdot yi + xi \cdot \left(\cos t\_2 \cdot t\_1\right)\right) - \left(ux - 1\right) \cdot \left(\left(maxCos \cdot ux\right) \cdot zi\right)
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-*.f3299.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (sin (* (* (PI) uy) 2.0)) yi)
(* xi (* (cos (* (* 2.0 uy) (PI))) (sqrt (- 1.0 (* t_0 t_0))))))
(* (* (* (- ux 1.0) maxCos) zi) ux))))\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(\cos \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0)))
(-
(+ (* (cos t_0) xi) (* (sin t_0) yi))
(* (* (* (- ux 1.0) maxCos) zi) ux))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
\left(\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
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.9
Applied rewrites98.9%
Final simplification98.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* 2.0 uy) (PI))))
(-
(+ (* (cos t_0) xi) (* (sin t_0) yi))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\\
\left(\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.9%
Taylor expanded in ux 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.f3229.9
Applied rewrites29.7%
Applied rewrites98.8%
Final simplification98.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (sqrt (PI))) (t_1 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (* (* yi (PI)) uy) 2.0)
(* (* (cos (* (* t_0 (* 2.0 uy)) t_0)) (sqrt (- 1.0 (* t_1 t_1)))) xi))
(* (* (* (- ux 1.0) maxCos) zi) ux))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 + \left(\cos \left(\left(t\_0 \cdot \left(2 \cdot uy\right)\right) \cdot t\_0\right) \cdot \sqrt{1 - t\_1 \cdot t\_1}\right) \cdot xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
Applied rewrites89.2%
lift-*.f32N/A
lift-PI.f32N/A
add-sqr-sqrtN/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-PI.f32N/A
lower-sqrt.f32N/A
lift-PI.f32N/A
lower-sqrt.f3289.2
Applied rewrites89.2%
Final simplification89.2%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (* (cos (* (+ uy uy) (PI))) (sqrt (- 1.0 (* t_0 t_0)))) xi)
(* (* (* yi (PI)) uy) 2.0))
(* (* (* (- ux 1.0) maxCos) zi) ux))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\left(\cos \left(\left(uy + uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right) \cdot xi + \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
Applied rewrites89.2%
lift-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f32N/A
count-2N/A
lift-*.f32N/A
lift-*.f32N/A
distribute-lft-outN/A
lower-*.f32N/A
lower-+.f3289.2
Applied rewrites89.2%
Final simplification89.2%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (+ (* (* (* yi (PI)) uy) 2.0) (* (cos (* (* (PI) uy) 2.0)) xi)) (* (* (* (- ux 1.0) maxCos) zi) ux)))
\begin{array}{l}
\\
\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 + \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot zi\right) \cdot ux
\end{array}
Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3299.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3299.0
Applied rewrites99.0%
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.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
Applied rewrites89.2%
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.f3289.1
Applied rewrites89.1%
Final simplification89.1%
(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.999999936531045e-20)
(+ (* (* zi ux) maxCos) t_1)
(if (<= xi 4.0000000781659255e-24)
(- (* (sin t_0) yi) (* (* (* (- ux 1.0) maxCos) ux) zi))
(+ (* (* (- maxCos (* maxCos ux)) ux) zi) 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\\
\mathbf{if}\;xi \leq -1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;\left(zi \cdot ux\right) \cdot maxCos + t\_1\\
\mathbf{elif}\;xi \leq 4.0000000781659255 \cdot 10^{-24}:\\
\;\;\;\;\sin t\_0 \cdot yi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;\left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi + t\_1\\
\end{array}
\end{array}
if xi < -1.99999994e-20Initial program 99.4%
Taylor expanded in ux 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.4
Applied rewrites13.4%
Taylor expanded in xi around inf
Applied rewrites79.7%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3279.7
Applied rewrites79.7%
if -1.99999994e-20 < xi < 4.00000008e-24Initial program 98.3%
Taylor expanded in ux 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.f3253.0
Applied rewrites53.0%
Taylor expanded in xi around 0
Applied rewrites84.9%
if 4.00000008e-24 < xi Initial program 99.2%
Taylor expanded in ux 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.f3216.6
Applied rewrites16.6%
Taylor expanded in xi around inf
Applied rewrites78.3%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3278.4
Applied rewrites78.4%
Final simplification81.1%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0))
(t_1 (* (cos t_0) xi))
(t_2 (* (* zi ux) maxCos)))
(if (<= xi -1.999999936531045e-20)
(+ t_2 t_1)
(if (<= xi 4.0000000781659255e-24)
(+ (* (sin t_0) yi) t_2)
(+ (* (* (- maxCos (* maxCos ux)) ux) zi) 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\\
t_2 := \left(zi \cdot ux\right) \cdot maxCos\\
\mathbf{if}\;xi \leq -1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;t\_2 + t\_1\\
\mathbf{elif}\;xi \leq 4.0000000781659255 \cdot 10^{-24}:\\
\;\;\;\;\sin t\_0 \cdot yi + t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi + t\_1\\
\end{array}
\end{array}
if xi < -1.99999994e-20Initial program 99.4%
Taylor expanded in ux 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.4
Applied rewrites13.4%
Taylor expanded in xi around inf
Applied rewrites79.7%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3279.7
Applied rewrites79.7%
if -1.99999994e-20 < xi < 4.00000008e-24Initial program 98.3%
Taylor expanded in ux 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.f3253.0
Applied rewrites53.0%
Taylor expanded in xi around inf
Applied rewrites23.9%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3221.1
Applied rewrites21.1%
Taylor expanded in xi around 0
Applied rewrites81.5%
if 4.00000008e-24 < xi Initial program 99.2%
Taylor expanded in ux 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.f3216.6
Applied rewrites16.6%
Taylor expanded in xi around inf
Applied rewrites78.3%
Taylor expanded in ux around 0
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3278.4
Applied rewrites78.4%
Final simplification79.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0))
(t_1 (* (* zi ux) maxCos))
(t_2 (+ t_1 (* (cos t_0) xi))))
(if (<= xi -1.999999936531045e-20)
t_2
(if (<= xi 9.999999998199587e-24) (+ (* (sin t_0) yi) t_1) t_2))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
t_1 := \left(zi \cdot ux\right) \cdot maxCos\\
t_2 := t\_1 + \cos t\_0 \cdot xi\\
\mathbf{if}\;xi \leq -1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;xi \leq 9.999999998199587 \cdot 10^{-24}:\\
\;\;\;\;\sin t\_0 \cdot yi + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if xi < -1.99999994e-20 or 1e-23 < xi Initial program 99.3%
Taylor expanded in ux 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.f3214.6
Applied rewrites14.6%
Taylor expanded in xi around inf
Applied rewrites79.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3278.2
Applied rewrites78.2%
if -1.99999994e-20 < xi < 1e-23Initial program 98.3%
Taylor expanded in ux 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.f3253.3
Applied rewrites53.3%
Taylor expanded in xi around inf
Applied rewrites25.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3222.0
Applied rewrites22.0%
Taylor expanded in xi around 0
Applied rewrites80.6%
Final simplification79.1%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (+ (* (* zi ux) maxCos) (* (cos (* (* (PI) uy) 2.0)) xi)))
\begin{array}{l}
\\
\left(zi \cdot ux\right) \cdot maxCos + \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot xi
\end{array}
Initial program 98.9%
Taylor expanded in ux 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.f3229.7
Applied rewrites29.7%
Taylor expanded in xi around inf
Applied rewrites58.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3256.3
Applied rewrites56.3%
Final simplification56.3%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (fma (fma (* (* (* (PI) (PI)) xi) uy) -2.0 (* (* yi (PI)) 2.0)) uy xi) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\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
\end{array}
Initial program 98.9%
Taylor expanded in ux 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.f3229.7
Applied rewrites29.7%
Taylor expanded in uy around 0
Applied rewrites49.7%
Final simplification49.7%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (fma (* (* uy uy) -2.0) (* (* (PI) (PI)) xi) xi) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi, xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.9%
Taylor expanded in ux 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.f3229.7
Applied rewrites29.7%
Taylor expanded in xi around inf
Applied rewrites58.0%
Taylor expanded in uy around 0
Applied rewrites49.4%
Final simplification49.7%
(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.9%
Taylor expanded in ux 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.f3229.7
Applied rewrites29.7%
Taylor expanded in xi around inf
Applied rewrites58.0%
Taylor expanded in uy around 0
Applied rewrites12.3%
Final simplification49.7%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (+ (fma (* (* yi (PI)) uy) 2.0 xi) (* (* zi ux) maxCos)))
\begin{array}{l}
\\
\mathsf{fma}\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy, 2, xi\right) + \left(zi \cdot ux\right) \cdot maxCos
\end{array}
Initial program 98.9%
Taylor expanded in ux 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.f3229.7
Applied rewrites29.7%
Taylor expanded in xi around inf
Applied rewrites58.0%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f3256.3
Applied rewrites56.3%
Taylor expanded in uy around 0
Applied rewrites14.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* (* zi (- 1.0 ux)) maxCos) ux))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return ((zi * (1.0f - ux)) * maxCos) * 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 * (1.0e0 - ux)) * maxcos) * ux
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(Float32(zi * Float32(Float32(1.0) - ux)) * maxCos) * ux) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = ((zi * (single(1.0) - ux)) * maxCos) * ux; end
\begin{array}{l}
\\
\left(\left(zi \cdot \left(1 - ux\right)\right) \cdot maxCos\right) \cdot ux
\end{array}
Initial program 98.9%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3211.7
Applied rewrites11.7%
Applied rewrites11.8%
(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(zi * Float32(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}
\\
zi \cdot \left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)
\end{array}
Initial program 98.9%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3211.7
Applied rewrites11.7%
Applied rewrites11.7%
Final simplification11.7%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* (- zi (* zi ux)) ux) maxCos))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return ((zi - (zi * ux)) * 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 - (zi * ux)) * ux) * maxcos
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(Float32(zi - Float32(zi * ux)) * ux) * maxCos) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = ((zi - (zi * ux)) * ux) * maxCos; end
\begin{array}{l}
\\
\left(\left(zi - zi \cdot ux\right) \cdot ux\right) \cdot maxCos
\end{array}
Initial program 98.9%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3211.7
Applied rewrites11.7%
Taylor expanded in ux around 0
Applied rewrites11.7%
(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.9%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3211.7
Applied rewrites11.7%
Taylor expanded in ux around 0
Applied rewrites10.7%
herbie shell --seed 2024276
(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)))