
(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 17 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 (* (* (- 1.0 ux) maxCos) ux)))
(-
(+
(* yi (* (sqrt (- 1.0 (* t_0 t_0))) (sin (* (* 2.0 uy) (PI)))))
(* (cos (* (* (PI) uy) 2.0)) xi))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
\left(yi \cdot \left(\sqrt{1 - t\_0 \cdot t\_0} \cdot \sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)\right) + \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 ux\right) \cdot zi
\end{array}
\end{array}
Initial program 99.1%
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.f3299.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (PI) uy) 2.0)))
(-
(+ (* (sin t_0) yi) (* (cos t_0) xi))
(* (* (* (- 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(\sin t\_0 \cdot yi + \cos t\_0 \cdot xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 99.1%
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.f3299.1
Applied rewrites99.1%
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.f3299.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (+ (- (* (cos (* (* 2.0 uy) (PI))) xi) (* (* (* (- ux 1.0) maxCos) ux) zi)) (* (sin (* (* (PI) uy) 2.0)) yi)))
\begin{array}{l}
\\
\left(\cos \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) + \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi
\end{array}
Initial program 99.1%
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.f3299.1
Applied rewrites99.1%
lift-+.f32N/A
Applied rewrites99.1%
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.f3299.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- 1.0 ux) maxCos) ux)))
(-
(+
(* (* (* yi (PI)) uy) 2.0)
(* (* (cos (* (* 2.0 uy) (PI))) (sqrt (- 1.0 (* t_0 t_0)))) xi))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 + \left(\cos \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\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 99.1%
lift-*.f32N/A
*-commutativeN/A
lift-PI.f32N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f32N/A
pow2N/A
lower-pow.f32N/A
lift-PI.f32N/A
lower-cbrt.f32N/A
lower-*.f32N/A
lift-PI.f32N/A
lower-cbrt.f3298.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3298.7
Applied rewrites98.7%
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.f3299.0
Applied rewrites99.0%
Taylor expanded in uy around 0
Applied rewrites90.8%
Final simplification90.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- 1.0 ux) maxCos) ux)))
(-
(+
(* 1.0 xi)
(* yi (* (sqrt (- 1.0 (* t_0 t_0))) (sin (* (* 2.0 uy) (PI))))))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
\left(1 \cdot xi + yi \cdot \left(\sqrt{1 - t\_0 \cdot t\_0} \cdot \sin \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 99.1%
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.f3299.1
Applied rewrites99.1%
Taylor expanded in uy around 0
Applied rewrites89.5%
Final simplification89.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (* (* uy uy) (- (* (* (* (PI) (PI)) xi) -2.0) (/ (- (* -2.0 (* yi (PI))) (/ xi uy)) uy))) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\left(uy \cdot uy\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot -2 - \frac{-2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) - \frac{xi}{uy}}{uy}\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
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.f3231.5
Applied rewrites31.5%
Taylor expanded in uy around 0
Applied rewrites55.0%
Taylor expanded in uy around -inf
Applied rewrites86.5%
Final simplification86.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi)) (t_1 (* yi (PI))))
(if (<= yi -1.499999973677505e-14)
(- (* (* (/ t_1 uy) 2.0) (* uy uy)) t_0)
(if (<= yi 4.999999980020986e-13)
(- (* (fma (* (* uy uy) 2.0) (* (PI) (PI)) -1.0) (- xi)) t_0)
(- (* (* t_1 uy) 2.0) 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)\\
\mathbf{if}\;yi \leq -1.499999973677505 \cdot 10^{-14}:\\
\;\;\;\;\left(\frac{t\_1}{uy} \cdot 2\right) \cdot \left(uy \cdot uy\right) - t\_0\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot 2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), -1\right) \cdot \left(-xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot uy\right) \cdot 2 - t\_0\\
\end{array}
\end{array}
if yi < -1.49999997e-14Initial 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.f3249.6
Applied rewrites49.6%
Taylor expanded in uy around 0
Applied rewrites23.7%
Taylor expanded in uy around inf
Applied rewrites7.4%
Taylor expanded in xi around 0
Applied rewrites56.9%
if -1.49999997e-14 < yi < 4.99999998e-13Initial 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.f3221.5
Applied rewrites21.5%
Taylor expanded in uy around 0
Applied rewrites72.2%
Taylor expanded in yi around 0
Applied rewrites71.9%
Taylor expanded in xi around -inf
Applied rewrites72.1%
if 4.99999998e-13 < yi 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.f3246.7
Applied rewrites46.7%
Taylor expanded in uy around 0
Applied rewrites28.9%
Taylor expanded in xi around 0
Applied rewrites52.6%
Final simplification63.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (- (* (* (* yi (PI)) uy) 2.0) t_0)))
(if (<= yi -1.499999973677505e-14)
t_1
(if (<= yi 4.999999980020986e-13)
(- (* (fma (* (* uy uy) 2.0) (* (PI) (PI)) -1.0) (- xi)) t_0)
t_1))))\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(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 - t\_0\\
\mathbf{if}\;yi \leq -1.499999973677505 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot 2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), -1\right) \cdot \left(-xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if yi < -1.49999997e-14 or 4.99999998e-13 < yi 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.f3248.1
Applied rewrites48.1%
Taylor expanded in uy around 0
Applied rewrites26.3%
Taylor expanded in xi around 0
Applied rewrites54.6%
if -1.49999997e-14 < yi < 4.99999998e-13Initial 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.f3221.5
Applied rewrites21.5%
Taylor expanded in uy around 0
Applied rewrites72.2%
Taylor expanded in yi around 0
Applied rewrites71.9%
Taylor expanded in xi around -inf
Applied rewrites72.1%
Final simplification64.3%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (+ (* (fma -2.0 (* (* (* (PI) (PI)) xi) uy) (* (* yi (PI)) 2.0)) uy) xi) (* (* (* (- ux 1.0) maxCos) ux) zi)))
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-2, \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right) \cdot uy + xi\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
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.f3231.6
Applied rewrites31.5%
Taylor expanded in uy around 0
Applied rewrites55.0%
Applied rewrites82.8%
Final simplification81.6%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi))
(t_1 (- (* (* (* yi (PI)) uy) 2.0) t_0)))
(if (<= yi -9.9999998245167e-15)
t_1
(if (<= yi 4.999999980020986e-13)
(- (fma (* (* uy uy) -2.0) (* (* (PI) (PI)) xi) xi) t_0)
t_1))))\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(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 - t\_0\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\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) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if yi < -9.99999982e-15 or 4.99999998e-13 < yi 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.f3247.8
Applied rewrites47.8%
Taylor expanded in uy around 0
Applied rewrites26.5%
Taylor expanded in xi around 0
Applied rewrites54.3%
if -9.99999982e-15 < yi < 4.99999998e-13Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites72.3%
Taylor expanded in yi around 0
Applied rewrites72.1%
Final simplification65.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(- (* (* (* yi (PI)) uy) 2.0) (* (* (* (- ux 1.0) maxCos) ux) zi))))
(if (<= yi -9.9999998245167e-15)
t_0
(if (<= yi 4.999999980020986e-13)
(+
(* (* (- maxCos (* maxCos ux)) ux) zi)
(fma (* (* uy uy) -2.0) (* (* (PI) (PI)) xi) xi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) \cdot zi + \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)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -9.99999982e-15 or 4.99999998e-13 < yi 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.f3247.8
Applied rewrites47.8%
Taylor expanded in uy around 0
Applied rewrites26.5%
Taylor expanded in xi around 0
Applied rewrites54.3%
if -9.99999982e-15 < yi < 4.99999998e-13Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites72.3%
Taylor expanded in yi around 0
Applied rewrites72.3%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
*-commutativeN/A
lower-*.f3272.3
Applied rewrites72.1%
Final simplification65.2%
(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) 2.0) t_0)))
(if (<= yi -9.9999998245167e-15)
t_2
(if (<= yi 4.999999980020986e-13) (- (fma (* t_1 2.0) uy xi) 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 := yi \cdot \mathsf{PI}\left(\right)\\
t_2 := \left(t\_1 \cdot uy\right) \cdot 2 - t\_0\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot 2, uy, xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if yi < -9.99999982e-15 or 4.99999998e-13 < yi 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.f3247.8
Applied rewrites47.8%
Taylor expanded in uy around 0
Applied rewrites26.5%
Taylor expanded in xi around 0
Applied rewrites54.3%
if -9.99999982e-15 < yi < 4.99999998e-13Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites72.3%
Taylor expanded in xi around 0
Applied rewrites61.5%
Final simplification65.1%
(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 (- (* t_1 2.0) t_0)))
(if (<= yi -9.9999998245167e-15)
t_2
(if (<= yi 4.999999980020986e-13) (- (fma t_1 2.0 xi) 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 := t\_1 \cdot 2 - t\_0\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;yi \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 2, xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if yi < -9.99999982e-15 or 4.99999998e-13 < yi 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.f3247.8
Applied rewrites47.8%
Taylor expanded in uy around 0
Applied rewrites26.5%
Taylor expanded in xi around 0
Applied rewrites54.3%
if -9.99999982e-15 < yi < 4.99999998e-13Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites72.3%
Taylor expanded in yi around 0
Applied rewrites72.1%
Taylor expanded in uy around 0
Applied rewrites72.0%
Final simplification64.6%
(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 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.f3231.5
Applied rewrites31.5%
Taylor expanded in uy around 0
Applied rewrites55.0%
Taylor expanded in xi around 0
Applied rewrites36.5%
Final simplification36.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(zi * Float32(Float32(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}
\\
zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)
\end{array}
Initial program 99.1%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3214.2
Applied rewrites14.2%
Applied rewrites14.2%
Final simplification14.2%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* (* zi (- 1.0 ux)) ux) maxCos))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return ((zi * (1.0f - 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 * (1.0e0 - ux)) * ux) * maxcos
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(Float32(zi * Float32(Float32(1.0) - ux)) * ux) * maxCos) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = ((zi * (single(1.0) - ux)) * ux) * maxCos; end
\begin{array}{l}
\\
\left(\left(zi \cdot \left(1 - ux\right)\right) \cdot ux\right) \cdot maxCos
\end{array}
Initial program 99.1%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3214.2
Applied rewrites14.2%
(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 99.1%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-*.f32N/A
lower--.f3214.2
Applied rewrites14.2%
Taylor expanded in ux around 0
Applied rewrites13.2%
herbie shell --seed 2024259
(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)))