
(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 14 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) (* 2.0 uy)))
(t_1 (* (* maxCos (- 1.0 ux)) ux))
(t_2 (sqrt (- 1.0 (* t_1 t_1)))))
(+
(* zi (* (- maxCos (* maxCos ux)) ux))
(+ (* yi (* (sin t_0) t_2)) (* xi (* t_2 (cos t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
t_1 := \left(maxCos \cdot \left(1 - ux\right)\right) \cdot ux\\
t_2 := \sqrt{1 - t\_1 \cdot t\_1}\\
zi \cdot \left(\left(maxCos - maxCos \cdot ux\right) \cdot ux\right) + \left(yi \cdot \left(\sin t\_0 \cdot t\_2\right) + xi \cdot \left(t\_2 \cdot \cos t\_0\right)\right)
\end{array}
\end{array}
Initial program 99.2%
Taylor expanded in ux around 0
*-commutativeN/A
lower-*.f32N/A
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-*.f3299.2
Applied rewrites99.2%
Final simplification99.2%
(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 99.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.f3299.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (PI) (* 2.0 uy))))
(-
(+ (* xi (cos t_0)) (* yi (sin t_0)))
(* (* (* (- ux 1.0) maxCos) ux) zi))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
\left(xi \cdot \cos t\_0 + yi \cdot \sin t\_0\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
\end{array}
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.f3229.3
Applied rewrites29.3%
Applied rewrites99.1%
Final simplification99.1%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(if (<= (* 2.0 uy) 0.11999999731779099)
(-
(*
(* uy uy)
(-
(* (* (* (PI) (PI)) xi) -2.0)
(/ (- (* (* yi (PI)) -2.0) (/ xi uy)) uy)))
(* (* (* (- ux 1.0) maxCos) ux) zi))
(-
(* (sin (* (* (PI) uy) 2.0)) yi)
(* (/ (* (- (* ux ux) 1.0) (* maxCos ux)) (+ ux 1.0)) zi))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.11999999731779099:\\
\;\;\;\;\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{\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot -2 - \frac{xi}{uy}}{uy}\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi - \frac{\left(ux \cdot ux - 1\right) \cdot \left(maxCos \cdot ux\right)}{ux + 1} \cdot zi\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 0.119999997Initial 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.f3232.1
Applied rewrites32.1%
Taylor expanded in uy around 0
Applied rewrites59.4%
Taylor expanded in uy around -inf
Applied rewrites92.0%
if 0.119999997 < (*.f32 uy #s(literal 2 binary32)) Initial program 99.0%
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.f3211.9
Applied rewrites11.9%
Taylor expanded in xi around 0
Applied rewrites59.6%
lift-*.f32N/A
lift--.f32N/A
lift-*.f32N/A
associate-*l*N/A
flip--N/A
associate-*l/N/A
lower-/.f32N/A
lower-*.f32N/A
metadata-evalN/A
lift-*.f32N/A
lower--.f32N/A
lower-*.f32N/A
+-commutativeN/A
lower-+.f3259.6
Applied rewrites59.6%
Final simplification87.5%
(FPCore (xi yi zi ux uy maxCos)
:precision binary32
(let* ((t_0 (* (* (* (- ux 1.0) maxCos) ux) zi)))
(if (<= (* 2.0 uy) 0.11999999731779099)
(-
(*
(* uy uy)
(-
(* (* (* (PI) (PI)) xi) -2.0)
(/ (- (* (* yi (PI)) -2.0) (/ xi uy)) uy)))
t_0)
(- (* (sin (* (* (PI) uy) 2.0)) yi) 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.11999999731779099:\\
\;\;\;\;\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{\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot -2 - \frac{xi}{uy}}{uy}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi - t\_0\\
\end{array}
\end{array}
if (*.f32 uy #s(literal 2 binary32)) < 0.119999997Initial 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.f3232.1
Applied rewrites32.1%
Taylor expanded in uy around 0
Applied rewrites59.4%
Taylor expanded in uy around -inf
Applied rewrites92.0%
if 0.119999997 < (*.f32 uy #s(literal 2 binary32)) Initial program 99.0%
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.f3211.9
Applied rewrites11.9%
Taylor expanded in xi around 0
Applied rewrites59.6%
Final simplification87.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (- (* (* uy uy) (- (* (* (* (PI) (PI)) xi) -2.0) (/ (- (* (* yi (PI)) -2.0) (/ 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{\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot -2 - \frac{xi}{uy}}{uy}\right) - \left(\left(\left(ux - 1\right) \cdot maxCos\right) \cdot ux\right) \cdot zi
\end{array}
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.f3229.3
Applied rewrites29.3%
Taylor expanded in uy around 0
Applied rewrites54.3%
Taylor expanded in uy around -inf
Applied rewrites84.4%
Final simplification84.4%
(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 -2.000000026702864e-10)
t_2
(if (<= yi 9.99999993922529e-9)
(- (+ (* (* (* uy uy) -2.0) (* (* (PI) (PI)) xi)) (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 -2.000000026702864 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;yi \leq 9.99999993922529 \cdot 10^{-9}:\\
\;\;\;\;\left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) + \mathsf{fma}\left(t\_1, 2, xi\right)\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if yi < -2.00000003e-10 or 9.99999994e-9 < yi Initial program 98.7%
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.f3245.6
Applied rewrites45.6%
Taylor expanded in uy around 0
Applied rewrites23.3%
Taylor expanded in xi around 0
Applied rewrites58.2%
if -2.00000003e-10 < yi < 9.99999994e-9Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites68.9%
Taylor expanded in yi around 0
Applied rewrites73.8%
Final simplification68.8%
(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 -2.000000026702864e-10)
t_2
(if (<= yi 9.99999993922529e-9)
(- (fma (fma t_1 2.0 (* (* (* (* (PI) (PI)) xi) uy) -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 -2.000000026702864 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;yi \leq 9.99999993922529 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(t\_1, 2, \left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy\right) \cdot -2\right), uy, xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if yi < -2.00000003e-10 or 9.99999994e-9 < yi Initial program 98.7%
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.f3245.6
Applied rewrites45.6%
Taylor expanded in uy around 0
Applied rewrites23.3%
Taylor expanded in xi around 0
Applied rewrites58.2%
if -2.00000003e-10 < yi < 9.99999994e-9Initial 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.f3221.7
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites68.9%
Applied rewrites68.9%
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) 2.0) t_0)))
(if (<= yi -2.000000026702864e-10)
t_1
(if (<= yi 9.99999993922529e-9)
(- (* (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 -2.000000026702864 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;yi \leq 9.99999993922529 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot xi - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if yi < -2.00000003e-10 or 9.99999994e-9 < yi Initial program 98.7%
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.f3246.6
Applied rewrites45.6%
Taylor expanded in uy around 0
Applied rewrites23.3%
Taylor expanded in xi around 0
Applied rewrites58.2%
if -2.00000003e-10 < yi < 9.99999994e-9Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites68.9%
Taylor expanded in uy around inf
Applied rewrites16.2%
Taylor expanded in xi around inf
Applied rewrites68.4%
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 (- (* t_1 2.0) t_0)))
(if (<= yi -2.000000026702864e-10)
t_2
(if (<= yi 9.99999993922529e-9) (- (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 -2.000000026702864 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;yi \leq 9.99999993922529 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 2, xi\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if yi < -2.00000003e-10 or 9.99999994e-9 < yi Initial program 98.7%
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.f3245.6
Applied rewrites45.6%
Taylor expanded in uy around 0
Applied rewrites23.3%
Taylor expanded in xi around 0
Applied rewrites58.2%
if -2.00000003e-10 < yi < 9.99999994e-9Initial 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.f3221.6
Applied rewrites21.6%
Taylor expanded in uy around 0
Applied rewrites68.9%
Taylor expanded in uy around 0
Applied rewrites68.9%
Final simplification65.5%
(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.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.f3229.6
Applied rewrites29.3%
Taylor expanded in uy around 0
Applied rewrites54.3%
Taylor expanded in xi around 0
Applied rewrites36.6%
Final simplification36.6%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi (* maxCos ux)) (- 1.0 ux)))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return (zi * (maxCos * ux)) * (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 * (maxcos * ux)) * (1.0e0 - ux)
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(zi * Float32(maxCos * ux)) * Float32(Float32(1.0) - ux)) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = (zi * (maxCos * ux)) * (single(1.0) - ux); end
\begin{array}{l}
\\
\left(zi \cdot \left(maxCos \cdot ux\right)\right) \cdot \left(1 - ux\right)
\end{array}
Initial program 99.2%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3214.5
Applied rewrites14.5%
Applied rewrites14.5%
Final simplification14.5%
(FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi (* maxCos (- 1.0 ux))) ux))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
return (zi * (maxCos * (1.0f - ux))) * ux;
}
real(4) function code(xi, yi, zi, ux, uy, maxcos)
real(4), intent (in) :: xi
real(4), intent (in) :: yi
real(4), intent (in) :: zi
real(4), intent (in) :: ux
real(4), intent (in) :: uy
real(4), intent (in) :: maxcos
code = (zi * (maxcos * (1.0e0 - ux))) * ux
end function
function code(xi, yi, zi, ux, uy, maxCos) return Float32(Float32(zi * Float32(maxCos * Float32(Float32(1.0) - ux))) * ux) end
function tmp = code(xi, yi, zi, ux, uy, maxCos) tmp = (zi * (maxCos * (single(1.0) - ux))) * ux; end
\begin{array}{l}
\\
\left(zi \cdot \left(maxCos \cdot \left(1 - ux\right)\right)\right) \cdot ux
\end{array}
Initial program 99.2%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3214.5
Applied rewrites14.5%
Applied rewrites14.5%
(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.2%
Taylor expanded in zi around inf
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower--.f3214.5
Applied rewrites14.5%
Taylor expanded in ux around 0
Applied rewrites12.4%
herbie shell --seed 2024331
(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)))