
(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 19 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 (* (PI) (* 2.0 uy))))
(-
(+
(* (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 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\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.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites98.8%
Final simplification98.8%
(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) (* 2.0 uy))))
(-
(+ (* (* (sin t_2) t_1) yi) (* xi (* t_1 (cos t_2))))
(* (* (* (- 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(2 \cdot uy\right)\\
\left(\left(\sin t\_2 \cdot t\_1\right) \cdot yi + xi \cdot \left(t\_1 \cdot \cos t\_2\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.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)
(* (* (sin (* (PI) (* 2.0 uy))) (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(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\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.8%
Taylor expanded in maxCos around 0
*-commutativeN/A
lower-*.f32N/A
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)))
(-
(+ (* (cos t_0) xi) (* (sin t_0) yi))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\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 ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.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.f3233.1
Applied rewrites33.1%
Applied rewrites98.5%
Final simplification98.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)) (t_1 (* (* (PI) uy) 2.0)))
(-
(+ (* (* t_1 (sqrt (- 1.0 (* t_0 t_0)))) yi) (* (cos t_1) 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\\
t_1 := \left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\\
\left(\left(t\_1 \cdot \sqrt{1 - t\_0 \cdot t\_0}\right) \cdot yi + \cos t\_1 \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%
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 uy around 0
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3290.3
Applied rewrites90.3%
Taylor expanded in maxCos around 0
lower-cos.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3290.3
Applied rewrites90.3%
Final simplification90.3%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= (* 2.0 uy) 0.11500000208616257)
(-
(+
(* (* (* yi (PI)) 2.0) uy)
(+ (* (* -2.0 (* (* (* (PI) (PI)) xi) uy)) uy) xi))
t_0)
(- (* (cos (* (* (PI) uy) 2.0)) xi) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;2 \cdot uy \leq 0.11500000208616257:\\
\;\;\;\;\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right) \cdot uy + \left(\left(-2 \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy\right)\right) \cdot uy + xi\right)\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot xi - t\_0\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 0.115000002Initial program 99.2%
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.f3237.5
Applied rewrites37.5%
Taylor expanded in uy around 0
Applied rewrites55.9%
Applied rewrites55.9%
Applied rewrites94.0%
if 0.115000002 < (*.f32 uy #s(literal 2 binary32)) Initial program 96.3%
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.f327.3
Applied rewrites7.3%
Taylor expanded in xi around inf
Applied rewrites58.3%
Final simplification88.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* yi (PI)))
(t_1 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_2
(-
(+ (* (fma (* (* (* (PI) (PI)) xi) uy) -2.0 (* t_0 2.0)) uy) xi)
t_1)))
(if (<= xi -2.1999998866057475e-28)
t_2
(if (<= xi 5.0000000843119176e-17) (- (* (* t_0 uy) 2.0) t_1) t_2))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := yi \cdot \mathsf{PI}\left(\right)\\
t_1 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_2 := \left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, t\_0 \cdot 2\right) \cdot uy + xi\right) - t\_1\\
\mathbf{if}\;xi \leq -2.1999998866057475 \cdot 10^{-28}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;xi \leq 5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_0 \cdot uy\right) \cdot 2 - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if xi < -2.19999989e-28 or 5.00000008e-17 < xi Initial program 98.9%
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.4
Applied rewrites15.4%
Taylor expanded in uy around 0
Applied rewrites59.9%
Applied rewrites59.9%
Applied rewrites74.7%
if -2.19999989e-28 < xi < 5.00000008e-17Initial program 98.6%
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.f3263.1
Applied rewrites63.1%
Taylor expanded in uy around 0
Applied rewrites35.0%
Taylor expanded in xi around 0
Applied rewrites70.0%
Final simplification73.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* -2.0 (* (* (* (PI) (PI)) xi) uy)))
(t_1 (* yi (PI)))
(t_2 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= xi -5.000000229068525e-19)
(- (fma uy (fma (* (PI) 2.0) yi t_0) xi) t_2)
(if (<= xi 5.0000000843119176e-17)
(- (* (* t_1 uy) 2.0) t_2)
(- (fma (fma t_1 2.0 t_0) uy xi) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := -2 \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy\right)\\
t_1 := yi \cdot \mathsf{PI}\left(\right)\\
t_2 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot 2, yi, t\_0\right), xi\right) - t\_2\\
\mathbf{elif}\;xi \leq 5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_1 \cdot uy\right) \cdot 2 - t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(t\_1, 2, t\_0\right), uy, xi\right) - t\_2\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Applied rewrites66.7%
Applied rewrites66.7%
if -5.00000023e-19 < xi < 5.00000008e-17Initial program 98.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.f3258.3
Applied rewrites58.3%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.5%
if 5.00000008e-17 < xi Initial program 98.9%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites63.8%
Applied rewrites63.8%
Final simplification65.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* yi (PI)))
(t_1 (* (PI) (PI)))
(t_2 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= xi -5.000000229068525e-19)
(- (fma uy (fma (* (PI) 2.0) yi (* -2.0 (* (* t_1 xi) uy))) xi) t_2)
(if (<= xi 5.0000000843119176e-17)
(- (* (* t_0 uy) 2.0) t_2)
(- (fma uy (fma (* -2.0 t_1) (* xi uy) (* t_0 2.0)) xi) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := yi \cdot \mathsf{PI}\left(\right)\\
t_1 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
t_2 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot 2, yi, -2 \cdot \left(\left(t\_1 \cdot xi\right) \cdot uy\right)\right), xi\right) - t\_2\\
\mathbf{elif}\;xi \leq 5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_0 \cdot uy\right) \cdot 2 - t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(-2 \cdot t\_1, xi \cdot uy, t\_0 \cdot 2\right), xi\right) - t\_2\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Applied rewrites66.7%
Applied rewrites66.7%
if -5.00000023e-19 < xi < 5.00000008e-17Initial program 98.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.f3258.3
Applied rewrites58.3%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.5%
if 5.00000008e-17 < xi Initial program 98.9%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites63.8%
Applied rewrites63.8%
Applied rewrites63.8%
Final simplification65.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (* (PI) (PI)))
(t_2 (* yi (PI))))
(if (<= xi -5.000000229068525e-19)
(- (* (fma (* (* uy uy) -2.0) t_1 1.0) xi) t_0)
(if (<= xi 5.0000000843119176e-17)
(- (* (* t_2 uy) 2.0) t_0)
(- (fma uy (fma (* -2.0 t_1) (* xi uy) (* t_2 2.0)) xi) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_1 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
t_2 := yi \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, t\_1, 1\right) \cdot xi - t\_0\\
\mathbf{elif}\;xi \leq 5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_2 \cdot uy\right) \cdot 2 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(-2 \cdot t\_1, xi \cdot uy, t\_2 \cdot 2\right), xi\right) - t\_0\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Taylor expanded in xi around inf
Applied rewrites65.5%
if -5.00000023e-19 < xi < 5.00000008e-17Initial program 98.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.f3258.3
Applied rewrites58.3%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.5%
if 5.00000008e-17 < xi Initial program 98.9%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites63.8%
Applied rewrites63.8%
Applied rewrites63.8%
Final simplification65.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (+ (* (* (* yi (PI)) 2.0) uy) (+ (* (* -2.0 (* (* (* (PI) (PI)) xi) uy)) uy) xi)) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right) \cdot uy + \left(\left(-2 \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy\right)\right) \cdot uy + xi\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.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.f3233.1
Applied rewrites33.1%
Taylor expanded in uy around 0
Applied rewrites50.7%
Applied rewrites50.7%
Applied rewrites84.5%
Final simplification84.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* yi (PI))) (t_1 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= xi -5.000000229068525e-19)
(- (* (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0) xi) t_1)
(if (<= xi 8.999999688540309e-17)
(- (* (* t_0 uy) 2.0) t_1)
(- (fma (* t_0 2.0) uy xi) t_1)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := yi \cdot \mathsf{PI}\left(\right)\\
t_1 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot xi - t\_1\\
\mathbf{elif}\;xi \leq 8.999999688540309 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_0 \cdot uy\right) \cdot 2 - t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot 2, uy, xi\right) - t\_1\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Taylor expanded in xi around inf
Applied rewrites65.5%
if -5.00000023e-19 < xi < 8.99999969e-17Initial program 98.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.f3257.9
Applied rewrites57.9%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.0%
if 8.99999969e-17 < xi Initial program 99.0%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites64.4%
Taylor expanded in xi around 0
Applied rewrites62.7%
Final simplification65.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (* yi (PI)))
(t_2 (* t_1 uy)))
(if (<= xi -5.000000229068525e-19)
(- (fma t_2 2.0 xi) t_0)
(if (<= xi 8.999999688540309e-17)
(- (* t_2 2.0) t_0)
(- (fma (* t_1 2.0) uy xi) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_1 := yi \cdot \mathsf{PI}\left(\right)\\
t_2 := t\_1 \cdot uy\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, 2, xi\right) - t\_0\\
\mathbf{elif}\;xi \leq 8.999999688540309 \cdot 10^{-17}:\\
\;\;\;\;t\_2 \cdot 2 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot 2, uy, xi\right) - t\_0\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Applied rewrites66.7%
Taylor expanded in uy around 0
Applied rewrites65.5%
if -5.00000023e-19 < xi < 8.99999969e-17Initial program 98.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.f3257.9
Applied rewrites57.9%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.0%
if 8.99999969e-17 < xi Initial program 99.0%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites64.4%
Taylor expanded in xi around 0
Applied rewrites62.7%
Final simplification65.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (* yi (PI)))
(t_2 (* t_1 uy)))
(if (<= xi -5.000000229068525e-19)
(- (fma t_2 2.0 xi) t_0)
(if (<= xi 5.0000000843119176e-17)
(- (* t_2 2.0) t_0)
(- (fma uy (* t_1 2.0) xi) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_1 := yi \cdot \mathsf{PI}\left(\right)\\
t_2 := t\_1 \cdot uy\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, 2, xi\right) - t\_0\\
\mathbf{elif}\;xi \leq 5.0000000843119176 \cdot 10^{-17}:\\
\;\;\;\;t\_2 \cdot 2 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(uy, t\_1 \cdot 2, xi\right) - t\_0\\
\end{array}
\end{array}
if xi < -5.00000023e-19Initial program 99.1%
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.f329.3
Applied rewrites9.3%
Taylor expanded in uy around 0
Applied rewrites66.7%
Applied rewrites66.7%
Taylor expanded in uy around 0
Applied rewrites65.5%
if -5.00000023e-19 < xi < 5.00000008e-17Initial program 98.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.f3258.3
Applied rewrites58.3%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.5%
if 5.00000008e-17 < xi Initial program 98.9%
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.f3212.4
Applied rewrites12.4%
Taylor expanded in uy around 0
Applied rewrites63.8%
Applied rewrites63.8%
Taylor expanded in xi around 0
Applied rewrites62.1%
Final simplification65.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (* (* yi (PI)) uy))
(t_2 (- (fma t_1 2.0 xi) t_0)))
(if (<= xi -5.000000229068525e-19)
t_2
(if (<= xi 8.999999688540309e-17) (- (* t_1 2.0) t_0) t_2))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
t_1 := \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\\
t_2 := \mathsf{fma}\left(t\_1, 2, xi\right) - t\_0\\
\mathbf{if}\;xi \leq -5.000000229068525 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;xi \leq 8.999999688540309 \cdot 10^{-17}:\\
\;\;\;\;t\_1 \cdot 2 - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if xi < -5.00000023e-19 or 8.99999969e-17 < xi Initial program 99.1%
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.f3210.6
Applied rewrites10.6%
Taylor expanded in uy around 0
Applied rewrites65.7%
Applied rewrites65.7%
Taylor expanded in uy around 0
Applied rewrites65.0%
if -5.00000023e-19 < xi < 8.99999969e-17Initial program 98.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.f3257.9
Applied rewrites57.9%
Taylor expanded in uy around 0
Applied rewrites34.1%
Taylor expanded in xi around 0
Applied rewrites65.0%
Final simplification65.4%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (* (* (* yi (PI)) uy) 2.0) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
Initial program 98.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.f3233.1
Applied rewrites33.1%
Taylor expanded in uy around 0
Applied rewrites50.7%
Taylor expanded in xi around 0
Applied rewrites38.3%
Final simplification38.3%
(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.8%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3213.4
Applied rewrites13.4%
Applied rewrites13.4%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi ux) (* maxCos (- 1.0 ux))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return (zi * ux) * (maxCos * (1.0f - 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 * ux) * (maxcos * (1.0e0 - ux))
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(zi * ux) * Float32(maxCos * Float32(Float32(1.0) - ux))) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = (zi * ux) * (maxCos * (single(1.0) - ux)); end
\begin{array}{l}
\\
\left(zi \cdot ux\right) \cdot \left(maxCos \cdot \left(1 - ux\right)\right)
\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.4
Applied rewrites13.4%
Applied rewrites13.4%
(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.4
Applied rewrites13.4%
Taylor expanded in ux around 0
Applied rewrites12.3%
herbie shell --seed 2024243
(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)))