
(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 12 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))))
(t_2 (* (PI) (* 2.0 uy))))
(-
(+ (* yi (* (sin t_2) t_1)) (* 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(yi \cdot \left(\sin t\_2 \cdot t\_1\right) + 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))
(t_1 (sqrt (- 1.0 (* t_0 t_0))))
(t_2 (* (PI) (* 2.0 uy))))
(-
(+ (* yi (* (sin t_2) t_1)) (* xi (* t_1 (cos t_2))))
(* (* (* (- ux 1.0) ux) maxCos) 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(yi \cdot \left(\sin t\_2 \cdot t\_1\right) + xi \cdot \left(t\_1 \cdot \cos t\_2\right)\right) - \left(\left(\left(ux - 1\right) \cdot ux\right) \cdot maxCos\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
Final simplification98.8%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- ux 1.0) (* maxCos ux)) zi))
(t_1 (* (* maxCos (- 1.0 ux)) ux))
(t_2 (sqrt (- 1.0 (* t_1 t_1))))
(t_3 (sqrt (- 1.0 (pow t_1 2.0)))))
(if (<= maxCos 9.999999960041972e-13)
(-
(+
(* (* (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0) t_2) xi)
(* yi (* (sin (* (PI) (* 2.0 uy))) t_2)))
t_0)
(- (+ (* t_3 xi) (* t_3 (* (* (* yi (PI)) uy) 2.0))) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
t_2 := \sqrt{1 - t\_1 \cdot t\_1}\\
t_3 := \sqrt{1 - {t\_1}^{2}}\\
\mathbf{if}\;maxCos \leq 9.999999960041972 \cdot 10^{-13}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot t\_2\right) \cdot xi + yi \cdot \left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot t\_2\right)\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 \cdot xi + t\_3 \cdot \left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\right)\right) - t\_0\\
\end{array}
\end{array}
if maxCos < 9.99999996e-13Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
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 uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3259.9
Applied rewrites59.9%
if 9.99999996e-13 < maxCos Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.7
Applied rewrites98.7%
Taylor expanded in uy around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f32N/A
Applied rewrites52.7%
Applied rewrites78.8%
Final simplification84.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* maxCos (- 1.0 ux)) ux)))
(-
(+
(* (sin (* (* (PI) uy) 2.0)) yi)
(* xi (* (sqrt (- 1.0 (* t_0 t_0))) (cos (* (PI) (* 2.0 uy))))))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi + xi \cdot \left(\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\right)\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
Initial program 98.8%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3298.7
Applied rewrites98.7%
Final simplification98.7%
(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) (* 2.0 uy))) (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(2 \cdot uy\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}\right)\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 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.5
Applied rewrites98.5%
Final simplification98.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (- ux 1.0) (* maxCos ux)) zi))
(t_1 (* (* maxCos (- 1.0 ux)) ux))
(t_2 (sqrt (- 1.0 (* t_1 t_1)))))
(if (<= maxCos 8.799999791364588e-12)
(-
(+
(* (* (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0) t_2) xi)
(* yi (* (sin (* (PI) (* 2.0 uy))) t_2)))
t_0)
(-
(*
(sqrt (- 1.0 (* (* (pow (- 1.0 ux) 2.0) (* ux ux)) (* maxCos maxCos))))
(fma 2.0 (* (* (fabs (PI)) yi) uy) xi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(ux - 1\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
t_2 := \sqrt{1 - t\_1 \cdot t\_1}\\
\mathbf{if}\;maxCos \leq 8.799999791364588 \cdot 10^{-12}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot t\_2\right) \cdot xi + yi \cdot \left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot t\_2\right)\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 - \left({\left(1 - ux\right)}^{2} \cdot \left(ux \cdot ux\right)\right) \cdot \left(maxCos \cdot maxCos\right)} \cdot \mathsf{fma}\left(2, \left(\left|\mathsf{PI}\left(\right)\right| \cdot yi\right) \cdot uy, xi\right) - t\_0\\
\end{array}
\end{array}
if maxCos < 8.79999979e-12Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
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 uy around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f32N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3259.7
Applied rewrites58.3%
if 8.79999979e-12 < maxCos Initial program 98.8%
lift-*.f32N/A
lift-*.f32N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f3298.7
Applied rewrites98.7%
Taylor expanded in uy around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f32N/A
Applied rewrites53.0%
Applied rewrites53.0%
Final simplification76.9%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(-
(* (sin (* (* (PI) uy) 2.0)) yi)
(* (* (* (- ux 1.0) maxCos) ux) zi))))
(if (<= yi -4.999999969612645e-9)
t_0
(if (<= yi 1.999999967550318e-17)
(-
(*
(sqrt
(- 1.0 (* (* (pow (- 1.0 ux) 2.0) (* ux ux)) (* maxCos maxCos))))
xi)
(* (* (* (- ux 1.0) ux) maxCos) zi))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;yi \leq -4.999999969612645 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 1.999999967550318 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{1 - \left({\left(1 - ux\right)}^{2} \cdot \left(ux \cdot ux\right)\right) \cdot \left(maxCos \cdot maxCos\right)} \cdot xi - \left(\left(\left(ux - 1\right) \cdot ux\right) \cdot maxCos\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -4.99999997e-9 or 1.99999997e-17 < yi Initial program 98.5%
Taylor expanded in xi around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites5.6%
Taylor expanded in ux around 0
Applied rewrites70.8%
if -4.99999997e-9 < yi < 1.99999997e-17Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites70.3%
Final simplification70.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(-
(* (sin (* (* (PI) uy) 2.0)) yi)
(* (* (* (- ux 1.0) maxCos) ux) zi))))
(if (<= yi -4.999999969612645e-9)
t_0
(if (<= yi 1.999999967550318e-17)
(-
(* (sqrt (- 1.0 (pow (* (* maxCos (- 1.0 ux)) ux) 2.0))) xi)
(* (* (* (- ux 1.0) zi) ux) maxCos))
t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;yi \leq -4.999999969612645 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 1.999999967550318 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{1 - {\left(\left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\right)}^{2}} \cdot xi - \left(\left(\left(ux - 1\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -4.99999997e-9 or 1.99999997e-17 < yi Initial program 98.5%
Taylor expanded in xi around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites7.5%
Taylor expanded in ux around 0
Applied rewrites70.8%
if -4.99999997e-9 < yi < 1.99999997e-17Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites17.1%
Applied rewrites70.2%
Final simplification70.4%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0
(-
(* (sin (* (* (PI) uy) 2.0)) yi)
(* (* (* (- ux 1.0) maxCos) ux) zi))))
(if (<= yi -4.999999969612645e-9)
t_0
(if (<= yi 1.999999967550318e-17) (+ (* (* zi ux) maxCos) xi) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{if}\;yi \leq -4.999999969612645 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;yi \leq 1.999999967550318 \cdot 10^{-17}:\\
\;\;\;\;\left(zi \cdot ux\right) \cdot maxCos + xi\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if yi < -4.99999997e-9 or 1.99999997e-17 < yi Initial program 98.5%
Taylor expanded in xi around 0
*-commutativeN/A
lower-*.f32N/A
Applied rewrites6.6%
Taylor expanded in ux around 0
Applied rewrites70.8%
if -4.99999997e-9 < yi < 1.99999997e-17Initial program 98.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.9
Applied rewrites98.9%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites17.1%
Taylor expanded in ux around 0
Applied rewrites60.0%
Applied rewrites66.0%
Final simplification67.8%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (+ (* (* zi ux) maxCos) xi))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return ((zi * ux) * maxCos) + xi;
}
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) + xi
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(Float32(zi * ux) * maxCos) + xi) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = ((zi * ux) * maxCos) + xi; end
\begin{array}{l}
\\
\left(zi \cdot ux\right) \cdot maxCos + xi
\end{array}
Initial program 98.8%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites13.4%
Taylor expanded in ux around 0
Applied rewrites44.9%
Applied rewrites48.6%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (fma maxCos (* zi ux) xi))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return fmaf(maxCos, (zi * ux), xi);
}
function code(xi, yi, zi, ux, uy, maxCos) return fma(maxCos, Float32(zi * ux), xi) end
\begin{array}{l}
\\
\mathsf{fma}\left(maxCos, zi \cdot ux, xi\right)
\end{array}
Initial program 98.8%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3298.8
Applied rewrites98.8%
Taylor expanded in uy around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites13.4%
Taylor expanded in ux around 0
Applied rewrites44.9%
Applied rewrites44.9%
(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
*-commutativeN/A
lower-*.f32N/A
lower--.f3213.4
Applied rewrites13.4%
Taylor expanded in ux around 0
Applied rewrites11.8%
herbie shell --seed 2024284
(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)))