UniformSampleCone 2

Percentage Accurate: 98.9% → 98.9%
Time: 24.4s
Alternatives: 28
Speedup: 1.0×

Specification

?
\[\left(\left(\left(\left(\left(-10000 \leq xi \land xi \leq 10000\right) \land \left(-10000 \leq yi \land yi \leq 10000\right)\right) \land \left(-10000 \leq zi \land zi \leq 10000\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq uy \land uy \leq 1\right)\right) \land \left(0 \leq maxCos \land maxCos \leq 1\right)\]
\[\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 \pi\\ \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))
        (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))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = ((1.0f - ux) * maxCos) * ux;
	float t_1 = sqrtf((1.0f - (t_0 * t_0)));
	float t_2 = (uy * 2.0f) * ((float) M_PI);
	return (((cosf(t_2) * t_1) * xi) + ((sinf(t_2) * t_1) * yi)) + (t_0 * zi);
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux)
	t_1 = sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))
	t_2 = Float32(Float32(uy * Float32(2.0)) * Float32(pi))
	return Float32(Float32(Float32(Float32(cos(t_2) * t_1) * xi) + Float32(Float32(sin(t_2) * t_1) * yi)) + Float32(t_0 * zi))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = ((single(1.0) - ux) * maxCos) * ux;
	t_1 = sqrt((single(1.0) - (t_0 * t_0)));
	t_2 = (uy * single(2.0)) * single(pi);
	tmp = (((cos(t_2) * t_1) * xi) + ((sin(t_2) * t_1) * yi)) + (t_0 * zi);
end
\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 \pi\\
\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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 28 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.9% accurate, 1.0× speedup?

\[\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 \pi\\ \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))
        (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))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = ((1.0f - ux) * maxCos) * ux;
	float t_1 = sqrtf((1.0f - (t_0 * t_0)));
	float t_2 = (uy * 2.0f) * ((float) M_PI);
	return (((cosf(t_2) * t_1) * xi) + ((sinf(t_2) * t_1) * yi)) + (t_0 * zi);
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(Float32(1.0) - ux) * maxCos) * ux)
	t_1 = sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0)))
	t_2 = Float32(Float32(uy * Float32(2.0)) * Float32(pi))
	return Float32(Float32(Float32(Float32(cos(t_2) * t_1) * xi) + Float32(Float32(sin(t_2) * t_1) * yi)) + Float32(t_0 * zi))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = ((single(1.0) - ux) * maxCos) * ux;
	t_1 = sqrt((single(1.0) - (t_0 * t_0)));
	t_2 = (uy * single(2.0)) * single(pi);
	tmp = (((cos(t_2) * t_1) * xi) + ((sin(t_2) * t_1) * yi)) + (t_0 * zi);
end
\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 \pi\\
\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}

Alternative 1: 98.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\ t_1 := \left(uy \cdot 2\right) \cdot \pi\\ \left(\left(\cos t\_1 \cdot \sqrt{1 + t\_0 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + \left(\sin t\_1 \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\mathsf{fma}\left(maxCos, \frac{maxCos}{ux}, \left(maxCos \cdot maxCos\right) \cdot -2\right)}{ux}\right)\right)}\right) \cdot yi\right) + t\_0 \cdot zi \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* ux (* (- 1.0 ux) maxCos))) (t_1 (* (* uy 2.0) PI)))
   (+
    (+
     (* (* (cos t_1) (sqrt (+ 1.0 (* t_0 (* ux (* maxCos (+ ux -1.0))))))) xi)
     (*
      (*
       (sin t_1)
       (sqrt
        (*
         (pow ux 4.0)
         (-
          (/ 1.0 (pow ux 4.0))
          (fma
           maxCos
           maxCos
           (/ (fma maxCos (/ maxCos ux) (* (* maxCos maxCos) -2.0)) ux))))))
      yi))
    (* t_0 zi))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = ux * ((1.0f - ux) * maxCos);
	float t_1 = (uy * 2.0f) * ((float) M_PI);
	return (((cosf(t_1) * sqrtf((1.0f + (t_0 * (ux * (maxCos * (ux + -1.0f))))))) * xi) + ((sinf(t_1) * sqrtf((powf(ux, 4.0f) * ((1.0f / powf(ux, 4.0f)) - fmaf(maxCos, maxCos, (fmaf(maxCos, (maxCos / ux), ((maxCos * maxCos) * -2.0f)) / ux)))))) * yi)) + (t_0 * zi);
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos))
	t_1 = Float32(Float32(uy * Float32(2.0)) * Float32(pi))
	return Float32(Float32(Float32(Float32(cos(t_1) * sqrt(Float32(Float32(1.0) + Float32(t_0 * Float32(ux * Float32(maxCos * Float32(ux + Float32(-1.0)))))))) * xi) + Float32(Float32(sin(t_1) * sqrt(Float32((ux ^ Float32(4.0)) * Float32(Float32(Float32(1.0) / (ux ^ Float32(4.0))) - fma(maxCos, maxCos, Float32(fma(maxCos, Float32(maxCos / ux), Float32(Float32(maxCos * maxCos) * Float32(-2.0))) / ux)))))) * yi)) + Float32(t_0 * zi))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\
t_1 := \left(uy \cdot 2\right) \cdot \pi\\
\left(\left(\cos t\_1 \cdot \sqrt{1 + t\_0 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + \left(\sin t\_1 \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\mathsf{fma}\left(maxCos, \frac{maxCos}{ux}, \left(maxCos \cdot maxCos\right) \cdot -2\right)}{ux}\right)\right)}\right) \cdot yi\right) + t\_0 \cdot zi
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Taylor expanded in ux around inf

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. pow-lowering-pow.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{4}} \cdot \left(\frac{1}{{ux}^{4}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. --lowering--.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \color{blue}{\left(\frac{1}{{ux}^{4}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. /-lowering-/.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\color{blue}{\frac{1}{{ux}^{4}}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. pow-lowering-pow.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{\color{blue}{{ux}^{4}}} - \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \left(\frac{{maxCos}^{2}}{{ux}^{2}} + {maxCos}^{2}\right)\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. associate-+r+N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \color{blue}{\left(\left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \frac{{maxCos}^{2}}{{ux}^{2}}\right) + {maxCos}^{2}\right)}\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. +-commutativeN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \color{blue}{\left({maxCos}^{2} + \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \frac{{maxCos}^{2}}{{ux}^{2}}\right)\right)}\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. unpow2N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \left(\color{blue}{maxCos \cdot maxCos} + \left(-2 \cdot \frac{{maxCos}^{2}}{ux} + \frac{{maxCos}^{2}}{{ux}^{2}}\right)\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. accelerator-lowering-fma.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \color{blue}{\mathsf{fma}\left(maxCos, maxCos, -2 \cdot \frac{{maxCos}^{2}}{ux} + \frac{{maxCos}^{2}}{{ux}^{2}}\right)}\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. +-commutativeN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \color{blue}{\frac{{maxCos}^{2}}{{ux}^{2}} + -2 \cdot \frac{{maxCos}^{2}}{ux}}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    11. unpow2N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{{maxCos}^{2}}{\color{blue}{ux \cdot ux}} + -2 \cdot \frac{{maxCos}^{2}}{ux}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    12. associate-/r*N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \color{blue}{\frac{\frac{{maxCos}^{2}}{ux}}{ux}} + -2 \cdot \frac{{maxCos}^{2}}{ux}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    13. metadata-evalN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\frac{{maxCos}^{2}}{ux}}{ux} + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)} \cdot \frac{{maxCos}^{2}}{ux}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    14. cancel-sign-sub-invN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \color{blue}{\frac{\frac{{maxCos}^{2}}{ux}}{ux} - 2 \cdot \frac{{maxCos}^{2}}{ux}}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    15. associate-*r/N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\frac{{maxCos}^{2}}{ux}}{ux} - \color{blue}{\frac{2 \cdot {maxCos}^{2}}{ux}}\right)\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  5. Simplified98.9%

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\mathsf{fma}\left(maxCos, \frac{maxCos}{ux}, \left(maxCos \cdot maxCos\right) \cdot -2\right)}{ux}\right)\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Final simplification98.9%

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{{ux}^{4} \cdot \left(\frac{1}{{ux}^{4}} - \mathsf{fma}\left(maxCos, maxCos, \frac{\mathsf{fma}\left(maxCos, \frac{maxCos}{ux}, \left(maxCos \cdot maxCos\right) \cdot -2\right)}{ux}\right)\right)}\right) \cdot yi\right) + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi \]
  7. Add Preprocessing

Alternative 2: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(uy \cdot 2\right) \cdot \pi\\ t_1 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\ t_2 := \sqrt{1 + t\_1 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\\ t\_1 \cdot zi + \left(\left(\cos t\_0 \cdot t\_2\right) \cdot xi + yi \cdot \left(t\_2 \cdot \sin t\_0\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (* uy 2.0) PI))
        (t_1 (* ux (* (- 1.0 ux) maxCos)))
        (t_2 (sqrt (+ 1.0 (* t_1 (* ux (* maxCos (+ ux -1.0))))))))
   (+ (* t_1 zi) (+ (* (* (cos t_0) t_2) xi) (* yi (* t_2 (sin t_0)))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = (uy * 2.0f) * ((float) M_PI);
	float t_1 = ux * ((1.0f - ux) * maxCos);
	float t_2 = sqrtf((1.0f + (t_1 * (ux * (maxCos * (ux + -1.0f))))));
	return (t_1 * zi) + (((cosf(t_0) * t_2) * xi) + (yi * (t_2 * sinf(t_0))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(uy * Float32(2.0)) * Float32(pi))
	t_1 = Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos))
	t_2 = sqrt(Float32(Float32(1.0) + Float32(t_1 * Float32(ux * Float32(maxCos * Float32(ux + Float32(-1.0)))))))
	return Float32(Float32(t_1 * zi) + Float32(Float32(Float32(cos(t_0) * t_2) * xi) + Float32(yi * Float32(t_2 * sin(t_0)))))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = (uy * single(2.0)) * single(pi);
	t_1 = ux * ((single(1.0) - ux) * maxCos);
	t_2 = sqrt((single(1.0) + (t_1 * (ux * (maxCos * (ux + single(-1.0)))))));
	tmp = (t_1 * zi) + (((cos(t_0) * t_2) * xi) + (yi * (t_2 * sin(t_0))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(uy \cdot 2\right) \cdot \pi\\
t_1 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\
t_2 := \sqrt{1 + t\_1 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\\
t\_1 \cdot zi + \left(\left(\cos t\_0 \cdot t\_2\right) \cdot xi + yi \cdot \left(t\_2 \cdot \sin t\_0\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Final simplification98.9%

    \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \left(\sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \pi\right)\right)\right) \]
  4. Add Preprocessing

Alternative 3: 99.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ t_1 := \sqrt{\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right), 1\right)}\\ \mathsf{fma}\left(t\_1 \cdot \sin t\_0, yi, \mathsf{fma}\left(t\_1, xi \cdot \cos t\_0, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* uy PI)))
        (t_1
         (sqrt
          (fma
           ux
           (* (- 1.0 ux) (* (* ux maxCos) (* maxCos (+ ux -1.0))))
           1.0))))
   (fma
    (* t_1 (sin t_0))
    yi
    (fma t_1 (* xi (cos t_0)) (* (- 1.0 ux) (* maxCos (* ux zi)))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = 2.0f * (uy * ((float) M_PI));
	float t_1 = sqrtf(fmaf(ux, ((1.0f - ux) * ((ux * maxCos) * (maxCos * (ux + -1.0f)))), 1.0f));
	return fmaf((t_1 * sinf(t_0)), yi, fmaf(t_1, (xi * cosf(t_0)), ((1.0f - ux) * (maxCos * (ux * zi)))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	t_1 = sqrt(fma(ux, Float32(Float32(Float32(1.0) - ux) * Float32(Float32(ux * maxCos) * Float32(maxCos * Float32(ux + Float32(-1.0))))), Float32(1.0)))
	return fma(Float32(t_1 * sin(t_0)), yi, fma(t_1, Float32(xi * cos(t_0)), Float32(Float32(Float32(1.0) - ux) * Float32(maxCos * Float32(ux * zi)))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
t_1 := \sqrt{\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right), 1\right)}\\
\mathsf{fma}\left(t\_1 \cdot \sin t\_0, yi, \mathsf{fma}\left(t\_1, xi \cdot \cos t\_0, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Applied egg-rr98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(-\left(1 - ux\right)\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right), 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), yi, \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(-\left(1 - ux\right)\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right), 1\right)}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot xi, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right)\right)} \]
  4. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right), 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), yi, \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right), 1\right)}, xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right)\right) \]
  5. Add Preprocessing

Alternative 4: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(uy \cdot 2\right) \cdot \pi\\ t_1 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\ t\_1 \cdot zi + \left(\left(\cos t\_0 \cdot \sqrt{1 + t\_1 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \left(\sin t\_0 \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (* uy 2.0) PI)) (t_1 (* ux (* (- 1.0 ux) maxCos))))
   (+
    (* t_1 zi)
    (+
     (* (* (cos t_0) (sqrt (+ 1.0 (* t_1 (* ux (* maxCos (+ ux -1.0))))))) xi)
     (* yi (* (sin t_0) (sqrt (fma (* maxCos maxCos) (* ux (- ux)) 1.0))))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = (uy * 2.0f) * ((float) M_PI);
	float t_1 = ux * ((1.0f - ux) * maxCos);
	return (t_1 * zi) + (((cosf(t_0) * sqrtf((1.0f + (t_1 * (ux * (maxCos * (ux + -1.0f))))))) * xi) + (yi * (sinf(t_0) * sqrtf(fmaf((maxCos * maxCos), (ux * -ux), 1.0f)))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(uy * Float32(2.0)) * Float32(pi))
	t_1 = Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos))
	return Float32(Float32(t_1 * zi) + Float32(Float32(Float32(cos(t_0) * sqrt(Float32(Float32(1.0) + Float32(t_1 * Float32(ux * Float32(maxCos * Float32(ux + Float32(-1.0)))))))) * xi) + Float32(yi * Float32(sin(t_0) * sqrt(fma(Float32(maxCos * maxCos), Float32(ux * Float32(-ux)), Float32(1.0)))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(uy \cdot 2\right) \cdot \pi\\
t_1 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\
t\_1 \cdot zi + \left(\left(\cos t\_0 \cdot \sqrt{1 + t\_1 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \left(\sin t\_0 \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Taylor expanded in ux around 0

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{1 + -1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{-1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right) + 1}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. mul-1-negN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({maxCos}^{2} \cdot {ux}^{2}\right)\right)} + 1}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{maxCos}^{2} \cdot \left(\mathsf{neg}\left({ux}^{2}\right)\right)} + 1}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. accelerator-lowering-fma.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left({maxCos}^{2}, \mathsf{neg}\left({ux}^{2}\right), 1\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. unpow2N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, \mathsf{neg}\left({ux}^{2}\right), 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, \mathsf{neg}\left({ux}^{2}\right), 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. unpow2N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. distribute-rgt-neg-inN/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. neg-lowering-neg.f3298.7

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  5. Simplified98.7%

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Final simplification98.7%

    \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}\right)\right) \]
  7. Add Preprocessing

Alternative 5: 98.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\ t\_0 \cdot zi + \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + t\_0 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* ux (* (- 1.0 ux) maxCos))))
   (+
    (* t_0 zi)
    (+
     (*
      (*
       (cos (* (* uy 2.0) PI))
       (sqrt (+ 1.0 (* t_0 (* ux (* maxCos (+ ux -1.0)))))))
      xi)
     (* yi (sin (* 2.0 (* uy PI))))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = ux * ((1.0f - ux) * maxCos);
	return (t_0 * zi) + (((cosf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f + (t_0 * (ux * (maxCos * (ux + -1.0f))))))) * xi) + (yi * sinf((2.0f * (uy * ((float) M_PI))))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos))
	return Float32(Float32(t_0 * zi) + Float32(Float32(Float32(cos(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) + Float32(t_0 * Float32(ux * Float32(maxCos * Float32(ux + Float32(-1.0)))))))) * xi) + Float32(yi * sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))))))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = ux * ((single(1.0) - ux) * maxCos);
	tmp = (t_0 * zi) + (((cos(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) + (t_0 * (ux * (maxCos * (ux + single(-1.0)))))))) * xi) + (yi * sin((single(2.0) * (uy * single(pi))))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\\
t\_0 \cdot zi + \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + t\_0 \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Taylor expanded in ux around 0

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. sin-lowering-sin.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + yi \cdot \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + yi \cdot \sin \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. *-lowering-*.f32N/A

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + yi \cdot \sin \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. PI-lowering-PI.f3298.7

      \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + yi \cdot \sin \left(2 \cdot \left(uy \cdot \color{blue}{\pi}\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  5. Simplified98.7%

    \[\leadsto \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Final simplification98.7%

    \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + \left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)}\right) \cdot xi + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) \]
  7. Add Preprocessing

Alternative 6: 98.2% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathsf{fma}\left(\mathsf{fma}\left(\cos t\_0, \frac{xi}{yi}, \sin t\_0\right), yi \cdot \sqrt{\mathsf{fma}\left(ux \cdot \left(-ux\right), maxCos \cdot maxCos, 1\right)}, \left(1 - ux\right) \cdot \left(zi \cdot \left(ux \cdot maxCos\right)\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* uy PI))))
   (fma
    (fma (cos t_0) (/ xi yi) (sin t_0))
    (* yi (sqrt (fma (* ux (- ux)) (* maxCos maxCos) 1.0)))
    (* (- 1.0 ux) (* zi (* ux maxCos))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = 2.0f * (uy * ((float) M_PI));
	return fmaf(fmaf(cosf(t_0), (xi / yi), sinf(t_0)), (yi * sqrtf(fmaf((ux * -ux), (maxCos * maxCos), 1.0f))), ((1.0f - ux) * (zi * (ux * maxCos))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	return fma(fma(cos(t_0), Float32(xi / yi), sin(t_0)), Float32(yi * sqrt(fma(Float32(ux * Float32(-ux)), Float32(maxCos * maxCos), Float32(1.0)))), Float32(Float32(Float32(1.0) - ux) * Float32(zi * Float32(ux * maxCos))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
\mathsf{fma}\left(\mathsf{fma}\left(\cos t\_0, \frac{xi}{yi}, \sin t\_0\right), yi \cdot \sqrt{\mathsf{fma}\left(ux \cdot \left(-ux\right), maxCos \cdot maxCos, 1\right)}, \left(1 - ux\right) \cdot \left(zi \cdot \left(ux \cdot maxCos\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Taylor expanded in xi around inf

    \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. distribute-rgt-outN/A

      \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. *-lowering-*.f32N/A

      \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  5. Simplified97.9%

    \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Taylor expanded in yi around inf

    \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  7. Simplified98.4%

    \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  8. Taylor expanded in ux around 0

    \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{-1 \cdot {ux}^{2}}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  9. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. unpow2N/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. mul-1-negN/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. *-lowering-*.f32N/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. mul-1-negN/A

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. neg-lowering-neg.f3298.1

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  10. Simplified98.1%

    \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  11. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \color{blue}{\left(yi \cdot \sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right) + 1}\right) \cdot \left(xi \cdot \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} + \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\left(xi \cdot \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} + \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \left(yi \cdot \sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right) + 1}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. accelerator-lowering-fma.f32N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(xi \cdot \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} + \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right) + 1}, \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
  12. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{xi}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right), yi \cdot \sqrt{\mathsf{fma}\left(ux \cdot \left(-ux\right), maxCos \cdot maxCos, 1\right)}, \left(1 - ux\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot zi\right)\right)} \]
  13. Final simplification98.2%

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{xi}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right), yi \cdot \sqrt{\mathsf{fma}\left(ux \cdot \left(-ux\right), maxCos \cdot maxCos, 1\right)}, \left(1 - ux\right) \cdot \left(zi \cdot \left(ux \cdot maxCos\right)\right)\right) \]
  14. Add Preprocessing

Alternative 7: 98.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(\sin t\_0, \frac{yi}{xi}, \cos t\_0\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* uy PI))))
   (+
    (* (* ux (* (- 1.0 ux) maxCos)) zi)
    (* xi (fma (sin t_0) (/ yi xi) (cos t_0))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = 2.0f * (uy * ((float) M_PI));
	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (xi * fmaf(sinf(t_0), (yi / xi), cosf(t_0)));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(xi * fma(sin(t_0), Float32(yi / xi), cos(t_0))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
\left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(\sin t\_0, \frac{yi}{xi}, \cos t\_0\right)
\end{array}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Add Preprocessing
  3. Taylor expanded in xi around inf

    \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  4. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. distribute-rgt-outN/A

      \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    3. *-lowering-*.f32N/A

      \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  5. Simplified97.9%

    \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Taylor expanded in maxCos around 0

    \[\leadsto xi \cdot \left(\color{blue}{1} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  7. Step-by-step derivation
    1. Simplified97.5%

      \[\leadsto xi \cdot \left(\color{blue}{1} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Final simplification97.5%

      \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) \]
    3. Add Preprocessing

    Alternative 8: 97.0% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ t_1 := \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}\\ \mathbf{if}\;uy \cdot 2 \leq 0.07999999821186066:\\ \;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, t\_1 \cdot \mathsf{fma}\left(-2, xi \cdot \left(\pi \cdot \pi\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right), t\_1 \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\right), \mathsf{fma}\left(xi, t\_1, maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(xi, \cos t\_0, yi \cdot \sin t\_0\right)\\ \end{array} \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* 2.0 (* uy PI)))
            (t_1
             (sqrt
              (fma
               (* maxCos maxCos)
               (* (* ux ux) (* (- 1.0 ux) (+ ux -1.0)))
               1.0))))
       (if (<= (* uy 2.0) 0.07999999821186066)
         (fma
          uy
          (fma
           uy
           (*
            t_1
            (fma
             -2.0
             (* xi (* PI PI))
             (* -1.3333333333333333 (* uy (* yi (* PI (* PI PI)))))))
           (* t_1 (* 2.0 (* PI yi))))
          (fma xi t_1 (* maxCos (* (- 1.0 ux) (* ux zi)))))
         (fma xi (cos t_0) (* yi (sin t_0))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	float t_0 = 2.0f * (uy * ((float) M_PI));
    	float t_1 = sqrtf(fmaf((maxCos * maxCos), ((ux * ux) * ((1.0f - ux) * (ux + -1.0f))), 1.0f));
    	float tmp;
    	if ((uy * 2.0f) <= 0.07999999821186066f) {
    		tmp = fmaf(uy, fmaf(uy, (t_1 * fmaf(-2.0f, (xi * (((float) M_PI) * ((float) M_PI))), (-1.3333333333333333f * (uy * (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))))), (t_1 * (2.0f * (((float) M_PI) * yi)))), fmaf(xi, t_1, (maxCos * ((1.0f - ux) * (ux * zi)))));
    	} else {
    		tmp = fmaf(xi, cosf(t_0), (yi * sinf(t_0)));
    	}
    	return tmp;
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
    	t_1 = sqrt(fma(Float32(maxCos * maxCos), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - ux) * Float32(ux + Float32(-1.0)))), Float32(1.0)))
    	tmp = Float32(0.0)
    	if (Float32(uy * Float32(2.0)) <= Float32(0.07999999821186066))
    		tmp = fma(uy, fma(uy, Float32(t_1 * fma(Float32(-2.0), Float32(xi * Float32(Float32(pi) * Float32(pi))), Float32(Float32(-1.3333333333333333) * Float32(uy * Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))))))), Float32(t_1 * Float32(Float32(2.0) * Float32(Float32(pi) * yi)))), fma(xi, t_1, Float32(maxCos * Float32(Float32(Float32(1.0) - ux) * Float32(ux * zi)))));
    	else
    		tmp = fma(xi, cos(t_0), Float32(yi * sin(t_0)));
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
    t_1 := \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}\\
    \mathbf{if}\;uy \cdot 2 \leq 0.07999999821186066:\\
    \;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, t\_1 \cdot \mathsf{fma}\left(-2, xi \cdot \left(\pi \cdot \pi\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right), t\_1 \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\right), \mathsf{fma}\left(xi, t\_1, maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(xi, \cos t\_0, yi \cdot \sin t\_0\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f32 uy #s(literal 2 binary32)) < 0.0799999982

      1. Initial program 99.2%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in uy around 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + \left(uy \cdot \left(2 \cdot \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + uy \cdot \left(-2 \cdot \left(\left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + \frac{-4}{3} \cdot \left(\left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)\right)\right) + xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} \]
      4. Simplified98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(-2, xi \cdot \left(\pi \cdot \pi\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right), \left(2 \cdot \left(yi \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)}\right), \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]

      if 0.0799999982 < (*.f32 uy #s(literal 2 binary32))

      1. Initial program 97.6%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in ux around 0

        \[\leadsto \color{blue}{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      4. Step-by-step derivation
        1. accelerator-lowering-fma.f32N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        2. cos-lowering-cos.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. *-lowering-*.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        4. *-lowering-*.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        5. PI-lowering-PI.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        6. *-lowering-*.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        7. sin-lowering-sin.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        8. *-lowering-*.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \sin \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        9. *-lowering-*.f32N/A

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \sin \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
        10. PI-lowering-PI.f3290.5

          \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \color{blue}{\pi}\right)\right)\right) \]
      5. Simplified90.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification96.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.07999999821186066:\\ \;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)} \cdot \mathsf{fma}\left(-2, xi \cdot \left(\pi \cdot \pi\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right), \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)} \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\right), \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 96.1% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathsf{fma}\left(xi, \cos t\_0, \mathsf{fma}\left(yi, \sin t\_0, zi \cdot \left(ux \cdot maxCos\right)\right)\right) \end{array} \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* 2.0 (* uy PI))))
       (fma xi (cos t_0) (fma yi (sin t_0) (* zi (* ux maxCos))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	float t_0 = 2.0f * (uy * ((float) M_PI));
    	return fmaf(xi, cosf(t_0), fmaf(yi, sinf(t_0), (zi * (ux * maxCos))));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
    	return fma(xi, cos(t_0), fma(yi, sin(t_0), Float32(zi * Float32(ux * maxCos))))
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
    \mathsf{fma}\left(xi, \cos t\_0, \mathsf{fma}\left(yi, \sin t\_0, zi \cdot \left(ux \cdot maxCos\right)\right)\right)
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right) + \left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
      2. associate-+l+N/A

        \[\leadsto \color{blue}{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
      3. accelerator-lowering-fma.f32N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
      4. cos-lowering-cos.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
      7. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
      8. accelerator-lowering-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
      9. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \sin \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right), maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
      12. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), maxCos \cdot \left(ux \cdot zi\right)\right)\right) \]
      13. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(maxCos \cdot ux\right) \cdot zi}\right)\right) \]
      14. *-lowering-*.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(maxCos \cdot ux\right) \cdot zi}\right)\right) \]
      15. *-lowering-*.f3295.5

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \color{blue}{\left(maxCos \cdot ux\right)} \cdot zi\right)\right) \]
    5. Simplified95.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(maxCos \cdot ux\right) \cdot zi\right)\right)} \]
    6. Final simplification95.5%

      \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), zi \cdot \left(ux \cdot maxCos\right)\right)\right) \]
    7. Add Preprocessing

    Alternative 10: 92.4% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (+
      (* (* ux (* (- 1.0 ux) maxCos)) zi)
      (*
       yi
       (*
        (sqrt (fma (* maxCos maxCos) (* (* ux ux) (* (- 1.0 ux) (+ ux -1.0))) 1.0))
        (fma
         xi
         (/ (fma (* -2.0 (* uy uy)) (* PI PI) 1.0) yi)
         (sin (* 2.0 (* uy PI))))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (yi * (sqrtf(fmaf((maxCos * maxCos), ((ux * ux) * ((1.0f - ux) * (ux + -1.0f))), 1.0f)) * fmaf(xi, (fmaf((-2.0f * (uy * uy)), (((float) M_PI) * ((float) M_PI)), 1.0f) / yi), sinf((2.0f * (uy * ((float) M_PI)))))));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(yi * Float32(sqrt(fma(Float32(maxCos * maxCos), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - ux) * Float32(ux + Float32(-1.0)))), Float32(1.0))) * fma(xi, Float32(fma(Float32(Float32(-2.0) * Float32(uy * uy)), Float32(Float32(pi) * Float32(pi)), Float32(1.0)) / yi), sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))))))
    end
    
    \begin{array}{l}
    
    \\
    \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in xi around inf

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. distribute-rgt-outN/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. Simplified97.9%

      \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. Taylor expanded in yi around inf

      \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Simplified98.4%

      \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. Taylor expanded in uy around 0

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{-2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + 1}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. associate-*r*N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. accelerator-lowering-fma.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\mathsf{fma}\left(-2 \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(\color{blue}{-2 \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      8. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right), 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      10. PI-lowering-PI.f3291.4

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \color{blue}{\pi}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. Simplified91.4%

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    11. Final simplification91.4%

      \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) \]
    12. Add Preprocessing

    Alternative 11: 92.3% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (+
      (* (* ux (* (- 1.0 ux) maxCos)) zi)
      (*
       yi
       (*
        (sqrt (fma (* maxCos maxCos) (* ux (- ux)) 1.0))
        (fma
         xi
         (/ (fma (* -2.0 (* uy uy)) (* PI PI) 1.0) yi)
         (sin (* 2.0 (* uy PI))))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (yi * (sqrtf(fmaf((maxCos * maxCos), (ux * -ux), 1.0f)) * fmaf(xi, (fmaf((-2.0f * (uy * uy)), (((float) M_PI) * ((float) M_PI)), 1.0f) / yi), sinf((2.0f * (uy * ((float) M_PI)))))));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(yi * Float32(sqrt(fma(Float32(maxCos * maxCos), Float32(ux * Float32(-ux)), Float32(1.0))) * fma(xi, Float32(fma(Float32(Float32(-2.0) * Float32(uy * uy)), Float32(Float32(pi) * Float32(pi)), Float32(1.0)) / yi), sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))))))
    end
    
    \begin{array}{l}
    
    \\
    \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in xi around inf

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. distribute-rgt-outN/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. Simplified97.9%

      \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. Taylor expanded in yi around inf

      \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Simplified98.4%

      \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. Taylor expanded in ux around 0

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{-1 \cdot {ux}^{2}}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. neg-lowering-neg.f3298.1

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. Simplified98.1%

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    11. Taylor expanded in uy around 0

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    12. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{-2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + 1}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. associate-*r*N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. accelerator-lowering-fma.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\mathsf{fma}\left(-2 \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(\color{blue}{-2 \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{2}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      8. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      9. PI-lowering-PI.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right), 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      10. PI-lowering-PI.f3291.0

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \color{blue}{\pi}, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    13. Simplified91.0%

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\color{blue}{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    14. Final simplification91.0%

      \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) \]
    15. Add Preprocessing

    Alternative 12: 89.4% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(maxCos, ux \cdot \left(\left(1 - ux\right) \cdot zi\right), \sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right), xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma
      maxCos
      (* ux (* (- 1.0 ux) zi))
      (*
       (sqrt
        (fma (* (* maxCos maxCos) (* ux (- ux))) (* (- 1.0 ux) (- 1.0 ux)) 1.0))
       (fma
        uy
        (fma
         2.0
         (* PI yi)
         (* (* yi (* PI (* PI PI))) (* -1.3333333333333333 (* uy uy))))
        (* xi (fma (* -2.0 (* uy uy)) (* PI PI) 1.0))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(maxCos, (ux * ((1.0f - ux) * zi)), (sqrtf(fmaf(((maxCos * maxCos) * (ux * -ux)), ((1.0f - ux) * (1.0f - ux)), 1.0f)) * fmaf(uy, fmaf(2.0f, (((float) M_PI) * yi), ((yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))) * (-1.3333333333333333f * (uy * uy)))), (xi * fmaf((-2.0f * (uy * uy)), (((float) M_PI) * ((float) M_PI)), 1.0f)))));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(maxCos, Float32(ux * Float32(Float32(Float32(1.0) - ux) * zi)), Float32(sqrt(fma(Float32(Float32(maxCos * maxCos) * Float32(ux * Float32(-ux))), Float32(Float32(Float32(1.0) - ux) * Float32(Float32(1.0) - ux)), Float32(1.0))) * fma(uy, fma(Float32(2.0), Float32(Float32(pi) * yi), Float32(Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))) * Float32(Float32(-1.3333333333333333) * Float32(uy * uy)))), Float32(xi * fma(Float32(Float32(-2.0) * Float32(uy * uy)), Float32(Float32(pi) * Float32(pi)), Float32(1.0))))))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(maxCos, ux \cdot \left(\left(1 - ux\right) \cdot zi\right), \sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right), xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in xi around inf

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. distribute-rgt-outN/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. Simplified97.9%

      \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. Taylor expanded in uy around 0

      \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. accelerator-lowering-fma.f32N/A

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. Simplified87.0%

      \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. Taylor expanded in xi around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + \left(\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \left(xi \cdot \left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} \]
    10. Simplified88.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), \sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(-ux \cdot ux\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right), xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\right)} \]
    11. Final simplification88.1%

      \[\leadsto \mathsf{fma}\left(maxCos, ux \cdot \left(\left(1 - ux\right) \cdot zi\right), \sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right), xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\right) \]
    12. Add Preprocessing

    Alternative 13: 88.4% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \frac{xi \cdot \left(\pi \cdot \pi\right)}{yi}, -1.3333333333333333 \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right), 2 \cdot \pi\right), \frac{xi}{yi}\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (+
      (* (* ux (* (- 1.0 ux) maxCos)) zi)
      (*
       yi
       (*
        (sqrt (fma (* maxCos maxCos) (* ux (- ux)) 1.0))
        (fma
         uy
         (fma
          uy
          (fma
           -2.0
           (/ (* xi (* PI PI)) yi)
           (* -1.3333333333333333 (* uy (* PI (* PI PI)))))
          (* 2.0 PI))
         (/ xi yi))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (yi * (sqrtf(fmaf((maxCos * maxCos), (ux * -ux), 1.0f)) * fmaf(uy, fmaf(uy, fmaf(-2.0f, ((xi * (((float) M_PI) * ((float) M_PI))) / yi), (-1.3333333333333333f * (uy * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))), (2.0f * ((float) M_PI))), (xi / yi))));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(yi * Float32(sqrt(fma(Float32(maxCos * maxCos), Float32(ux * Float32(-ux)), Float32(1.0))) * fma(uy, fma(uy, fma(Float32(-2.0), Float32(Float32(xi * Float32(Float32(pi) * Float32(pi))) / yi), Float32(Float32(-1.3333333333333333) * Float32(uy * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))))), Float32(Float32(2.0) * Float32(pi))), Float32(xi / yi)))))
    end
    
    \begin{array}{l}
    
    \\
    \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \frac{xi \cdot \left(\pi \cdot \pi\right)}{yi}, -1.3333333333333333 \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right), 2 \cdot \pi\right), \frac{xi}{yi}\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in xi around inf

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. distribute-rgt-outN/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. Simplified97.9%

      \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. Taylor expanded in yi around inf

      \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Simplified98.4%

      \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. Taylor expanded in ux around 0

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{-1 \cdot {ux}^{2}}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. unpow2N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. *-lowering-*.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. mul-1-negN/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. neg-lowering-neg.f3298.1

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. Simplified98.1%

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    11. Taylor expanded in uy around 0

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \mathsf{PI}\left(\right) + uy \cdot \left(-2 \cdot \frac{xi \cdot {\mathsf{PI}\left(\right)}^{2}}{yi} + \frac{-4}{3} \cdot \left(uy \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right) + \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    12. Step-by-step derivation
      1. accelerator-lowering-fma.f32N/A

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \mathsf{PI}\left(\right) + uy \cdot \left(-2 \cdot \frac{xi \cdot {\mathsf{PI}\left(\right)}^{2}}{yi} + \frac{-4}{3} \cdot \left(uy \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right), \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    13. Simplified86.9%

      \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \frac{xi \cdot \left(\pi \cdot \pi\right)}{yi}, -1.3333333333333333 \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right), 2 \cdot \pi\right), \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    14. Final simplification86.9%

      \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \frac{xi \cdot \left(\pi \cdot \pi\right)}{yi}, -1.3333333333333333 \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right), 2 \cdot \pi\right), \frac{xi}{yi}\right)\right) \]
    15. Add Preprocessing

    Alternative 14: 88.5% accurate, 3.3× speedup?

    \[\begin{array}{l} \\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(\pi \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(uy \cdot yi\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{\pi \cdot yi}{xi}\right), 1\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (+
      (* (* ux (* (- 1.0 ux) maxCos)) zi)
      (*
       xi
       (fma
        uy
        (fma
         uy
         (fma
          -1.3333333333333333
          (/ (* (* PI (* PI PI)) (* uy yi)) xi)
          (* -2.0 (* PI PI)))
         (* 2.0 (/ (* PI yi) xi)))
        1.0))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (xi * fmaf(uy, fmaf(uy, fmaf(-1.3333333333333333f, (((((float) M_PI) * (((float) M_PI) * ((float) M_PI))) * (uy * yi)) / xi), (-2.0f * (((float) M_PI) * ((float) M_PI)))), (2.0f * ((((float) M_PI) * yi) / xi))), 1.0f));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(xi * fma(uy, fma(uy, fma(Float32(-1.3333333333333333), Float32(Float32(Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))) * Float32(uy * yi)) / xi), Float32(Float32(-2.0) * Float32(Float32(pi) * Float32(pi)))), Float32(Float32(2.0) * Float32(Float32(Float32(pi) * yi) / xi))), Float32(1.0))))
    end
    
    \begin{array}{l}
    
    \\
    \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(\pi \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(uy \cdot yi\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{\pi \cdot yi}{xi}\right), 1\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Add Preprocessing
    3. Taylor expanded in xi around inf

      \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    4. Step-by-step derivation
      1. *-lowering-*.f32N/A

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. distribute-rgt-outN/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    5. Simplified97.9%

      \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    6. Taylor expanded in uy around 0

      \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. accelerator-lowering-fma.f32N/A

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    8. Simplified87.0%

      \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    9. Taylor expanded in maxCos around 0

      \[\leadsto xi \cdot \left(\color{blue}{1} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(\frac{-4}{3}, \frac{\left(uy \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}, -2 \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi}\right), 1\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    10. Step-by-step derivation
      1. Simplified86.6%

        \[\leadsto xi \cdot \left(\color{blue}{1} \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Final simplification86.6%

        \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(\pi \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(uy \cdot yi\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{\pi \cdot yi}{xi}\right), 1\right) \]
      3. Add Preprocessing

      Alternative 15: 84.8% accurate, 3.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot \left(1 - ux\right)\\ \mathbf{if}\;ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right) \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, t\_0 \cdot t\_0, 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (let* ((t_0 (* ux (- 1.0 ux))))
         (if (<= (* ux (* (- 1.0 ux) maxCos)) 1.999999936531045e-21)
           (*
            xi
            (fma
             uy
             (fma
              uy
              (fma
               -2.0
               (* PI PI)
               (/ (* -1.3333333333333333 (* uy (* yi (* PI (* PI PI))))) xi))
              (/ (* 2.0 (* PI yi)) xi))
             1.0))
           (fma
            (sqrt (fma (- (* maxCos maxCos)) (* t_0 t_0) 1.0))
            (fma 2.0 (* uy (* PI yi)) xi)
            (* (* ux maxCos) (* (- 1.0 ux) zi))))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	float t_0 = ux * (1.0f - ux);
      	float tmp;
      	if ((ux * ((1.0f - ux) * maxCos)) <= 1.999999936531045e-21f) {
      		tmp = xi * fmaf(uy, fmaf(uy, fmaf(-2.0f, (((float) M_PI) * ((float) M_PI)), ((-1.3333333333333333f * (uy * (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))) / xi)), ((2.0f * (((float) M_PI) * yi)) / xi)), 1.0f);
      	} else {
      		tmp = fmaf(sqrtf(fmaf(-(maxCos * maxCos), (t_0 * t_0), 1.0f)), fmaf(2.0f, (uy * (((float) M_PI) * yi)), xi), ((ux * maxCos) * ((1.0f - ux) * zi)));
      	}
      	return tmp;
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	t_0 = Float32(ux * Float32(Float32(1.0) - ux))
      	tmp = Float32(0.0)
      	if (Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) <= Float32(1.999999936531045e-21))
      		tmp = Float32(xi * fma(uy, fma(uy, fma(Float32(-2.0), Float32(Float32(pi) * Float32(pi)), Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))))) / xi)), Float32(Float32(Float32(2.0) * Float32(Float32(pi) * yi)) / xi)), Float32(1.0)));
      	else
      		tmp = fma(sqrt(fma(Float32(-Float32(maxCos * maxCos)), Float32(t_0 * t_0), Float32(1.0))), fma(Float32(2.0), Float32(uy * Float32(Float32(pi) * yi)), xi), Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi)));
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := ux \cdot \left(1 - ux\right)\\
      \mathbf{if}\;ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right) \leq 1.999999936531045 \cdot 10^{-21}:\\
      \;\;\;\;xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, t\_0 \cdot t\_0, 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f32 (*.f32 (-.f32 #s(literal 1 binary32) ux) maxCos) ux) < 1.9999999e-21

        1. Initial program 98.7%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in xi around inf

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. distribute-rgt-outN/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          3. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        5. Simplified98.5%

          \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        6. Taylor expanded in uy around 0

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        8. Simplified85.7%

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        9. Taylor expanded in maxCos around 0

          \[\leadsto \color{blue}{xi \cdot \left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)} \]
        10. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{xi \cdot \left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)} \]
          2. +-commutativeN/A

            \[\leadsto xi \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)} \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto xi \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)} \]
        11. Simplified84.9%

          \[\leadsto \color{blue}{xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right)} \]

        if 1.9999999e-21 < (*.f32 (*.f32 (-.f32 #s(literal 1 binary32) ux) maxCos) ux)

        1. Initial program 99.1%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in xi around inf

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. distribute-rgt-outN/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          3. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        5. Simplified97.1%

          \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        6. Taylor expanded in yi around inf

          \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        7. Simplified98.7%

          \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        8. Taylor expanded in uy around 0

          \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + \left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} \]
        9. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto 2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + \color{blue}{\left(xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
          2. associate-+r+N/A

            \[\leadsto \color{blue}{\left(2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          3. associate-*r*N/A

            \[\leadsto \left(\color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}} + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
          4. distribute-rgt-outN/A

            \[\leadsto \color{blue}{\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + xi\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
        10. Simplified85.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot \left(-maxCos\right), \left(ux \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(1 - ux\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \pi\right), xi\right), \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification84.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right) \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;xi \cdot \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, \left(ux \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(1 - ux\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 16: 86.0% accurate, 3.6× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(xi, \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right), maxCos \cdot \left(ux \cdot zi\right)\right) \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (fma
        xi
        (fma
         uy
         (fma
          uy
          (fma
           -2.0
           (* PI PI)
           (/ (* -1.3333333333333333 (* uy (* yi (* PI (* PI PI))))) xi))
          (/ (* 2.0 (* PI yi)) xi))
         1.0)
        (* maxCos (* ux zi))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	return fmaf(xi, fmaf(uy, fmaf(uy, fmaf(-2.0f, (((float) M_PI) * ((float) M_PI)), ((-1.3333333333333333f * (uy * (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))))) / xi)), ((2.0f * (((float) M_PI) * yi)) / xi)), 1.0f), (maxCos * (ux * zi)));
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	return fma(xi, fma(uy, fma(uy, fma(Float32(-2.0), Float32(Float32(pi) * Float32(pi)), Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))))) / xi)), Float32(Float32(Float32(2.0) * Float32(Float32(pi) * yi)) / xi)), Float32(1.0)), Float32(maxCos * Float32(ux * zi)))
      end
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(xi, \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right), maxCos \cdot \left(ux \cdot zi\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 98.9%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in xi around inf

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. distribute-rgt-outN/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        3. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. Simplified97.9%

        \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. Taylor expanded in uy around 0

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. accelerator-lowering-fma.f32N/A

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      8. Simplified87.0%

        \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      9. Taylor expanded in ux around 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right) + xi \cdot \left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)} \]
      10. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{xi \cdot \left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
        2. accelerator-lowering-fma.f32N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(xi, 1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right), maxCos \cdot \left(ux \cdot zi\right)\right)} \]
      11. Simplified83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-2, \pi \cdot \pi, \frac{-1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)}{xi}\right), \frac{2 \cdot \left(\pi \cdot yi\right)}{xi}\right), 1\right), maxCos \cdot \left(ux \cdot zi\right)\right)} \]
      12. Add Preprocessing

      Alternative 17: 60.7% accurate, 4.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}\\ \mathbf{elif}\;xi \leq 3.0000001167615996 \cdot 10^{-17}:\\ \;\;\;\;\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \left(xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\\ \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (if (<= xi -9.999999998199587e-24)
         (+
          (* (* ux (* (- 1.0 ux) maxCos)) zi)
          (*
           xi
           (sqrt
            (fma (* maxCos maxCos) (* (* ux ux) (* (- 1.0 ux) (+ ux -1.0))) 1.0))))
         (if (<= xi 3.0000001167615996e-17)
           (*
            (* uy yi)
            (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI)))
           (*
            (sqrt
             (fma (* (* maxCos maxCos) (* ux (- ux))) (* (- 1.0 ux) (- 1.0 ux)) 1.0))
            (* xi (fma (* -2.0 (* uy uy)) (* PI PI) 1.0))))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	float tmp;
      	if (xi <= -9.999999998199587e-24f) {
      		tmp = ((ux * ((1.0f - ux) * maxCos)) * zi) + (xi * sqrtf(fmaf((maxCos * maxCos), ((ux * ux) * ((1.0f - ux) * (ux + -1.0f))), 1.0f)));
      	} else if (xi <= 3.0000001167615996e-17f) {
      		tmp = (uy * yi) * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)));
      	} else {
      		tmp = sqrtf(fmaf(((maxCos * maxCos) * (ux * -ux)), ((1.0f - ux) * (1.0f - ux)), 1.0f)) * (xi * fmaf((-2.0f * (uy * uy)), (((float) M_PI) * ((float) M_PI)), 1.0f));
      	}
      	return tmp;
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	tmp = Float32(0.0)
      	if (xi <= Float32(-9.999999998199587e-24))
      		tmp = Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(xi * sqrt(fma(Float32(maxCos * maxCos), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - ux) * Float32(ux + Float32(-1.0)))), Float32(1.0)))));
      	elseif (xi <= Float32(3.0000001167615996e-17))
      		tmp = Float32(Float32(uy * yi) * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi))));
      	else
      		tmp = Float32(sqrt(fma(Float32(Float32(maxCos * maxCos) * Float32(ux * Float32(-ux))), Float32(Float32(Float32(1.0) - ux) * Float32(Float32(1.0) - ux)), Float32(1.0))) * Float32(xi * fma(Float32(Float32(-2.0) * Float32(uy * uy)), Float32(Float32(pi) * Float32(pi)), Float32(1.0))));
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\
      \;\;\;\;\left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}\\
      
      \mathbf{elif}\;xi \leq 3.0000001167615996 \cdot 10^{-17}:\\
      \;\;\;\;\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \left(xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if xi < -1e-23

        1. Initial program 99.3%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in uy around 0

          \[\leadsto \color{blue}{xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. sqrt-lowering-sqrt.f32N/A

            \[\leadsto xi \cdot \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          3. sub-negN/A

            \[\leadsto xi \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          4. mul-1-negN/A

            \[\leadsto xi \cdot \sqrt{1 + \color{blue}{-1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          5. +-commutativeN/A

            \[\leadsto xi \cdot \sqrt{\color{blue}{-1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right) + 1}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          6. mul-1-negN/A

            \[\leadsto xi \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)\right)} + 1} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          7. distribute-rgt-neg-inN/A

            \[\leadsto xi \cdot \sqrt{\color{blue}{{maxCos}^{2} \cdot \left(\mathsf{neg}\left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + 1} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          8. accelerator-lowering-fma.f32N/A

            \[\leadsto xi \cdot \sqrt{\color{blue}{\mathsf{fma}\left({maxCos}^{2}, \mathsf{neg}\left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right), 1\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        5. Simplified66.7%

          \[\leadsto \color{blue}{xi \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)}} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]

        if -1e-23 < xi < 3.0000001e-17

        1. Initial program 98.4%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in yi around inf

          \[\leadsto \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        5. Simplified66.5%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
        6. Taylor expanded in uy around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          3. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right)} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          16. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          17. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          18. PI-lowering-PI.f3262.0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \color{blue}{\pi}\right)\right)\right) \]
        8. Simplified62.0%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]
        9. Taylor expanded in yi around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        10. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          2. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
          16. PI-lowering-PI.f3262.1

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right)\right) \]
        11. Simplified62.1%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)}\right) \]
        12. Taylor expanded in maxCos around 0

          \[\leadsto \color{blue}{uy \cdot \left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        13. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right)} \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right) \]
          5. accelerator-lowering-fma.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          6. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          7. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          8. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          9. cube-multN/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          10. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          11. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          12. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          13. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          14. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          15. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
          16. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
          17. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right) \]
          18. PI-lowering-PI.f3261.7

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right) \]
        14. Simplified61.7%

          \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)} \]

        if 3.0000001e-17 < xi

        1. Initial program 99.2%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in xi around inf

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. distribute-rgt-outN/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          3. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        5. Simplified98.9%

          \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        6. Taylor expanded in uy around 0

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(1 + uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right)\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right)\right) + 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, 2 \cdot \frac{yi \cdot \mathsf{PI}\left(\right)}{xi} + uy \cdot \left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{-4}{3} \cdot \frac{uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        8. Simplified85.1%

          \[\leadsto xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, \frac{\left(uy \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{xi}, -2 \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \frac{yi \cdot \pi}{xi}\right), 1\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        9. Taylor expanded in xi around inf

          \[\leadsto \color{blue}{\left(xi \cdot \left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} \cdot \left(xi \cdot \left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} \cdot \left(xi \cdot \left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right)} \]
        11. Simplified73.0%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(-ux \cdot ux\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \left(xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification66.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + xi \cdot \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}\\ \mathbf{elif}\;xi \leq 3.0000001167615996 \cdot 10^{-17}:\\ \;\;\;\;\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(-ux\right)\right), \left(1 - ux\right) \cdot \left(1 - ux\right), 1\right)} \cdot \left(xi \cdot \mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \pi \cdot \pi, 1\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 18: 81.7% accurate, 4.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot \left(1 - ux\right)\\ \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, t\_0 \cdot t\_0, 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (let* ((t_0 (* ux (- 1.0 ux))))
         (fma
          (sqrt (fma (- (* maxCos maxCos)) (* t_0 t_0) 1.0))
          (fma 2.0 (* uy (* PI yi)) xi)
          (* (* ux maxCos) (* (- 1.0 ux) zi)))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	float t_0 = ux * (1.0f - ux);
      	return fmaf(sqrtf(fmaf(-(maxCos * maxCos), (t_0 * t_0), 1.0f)), fmaf(2.0f, (uy * (((float) M_PI) * yi)), xi), ((ux * maxCos) * ((1.0f - ux) * zi)));
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	t_0 = Float32(ux * Float32(Float32(1.0) - ux))
      	return fma(sqrt(fma(Float32(-Float32(maxCos * maxCos)), Float32(t_0 * t_0), Float32(1.0))), fma(Float32(2.0), Float32(uy * Float32(Float32(pi) * yi)), xi), Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi)))
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := ux \cdot \left(1 - ux\right)\\
      \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, t\_0 \cdot t\_0, 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)
      \end{array}
      \end{array}
      
      Derivation
      1. Initial program 98.9%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in xi around inf

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. distribute-rgt-outN/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        3. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. Simplified97.9%

        \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. Taylor expanded in yi around inf

        \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. Simplified98.4%

        \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      8. Taylor expanded in uy around 0

        \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + \left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} \]
      9. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + \color{blue}{\left(xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
        2. associate-+r+N/A

          \[\leadsto \color{blue}{\left(2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        3. associate-*r*N/A

          \[\leadsto \left(\color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}} + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
        4. distribute-rgt-outN/A

          \[\leadsto \color{blue}{\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + xi\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
      10. Simplified80.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot \left(-maxCos\right), \left(ux \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(1 - ux\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \pi\right), xi\right), \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
      11. Final simplification80.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-maxCos \cdot maxCos, \left(ux \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(1 - ux\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) \]
      12. Add Preprocessing

      Alternative 19: 81.7% accurate, 4.3× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right) \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (fma
        (sqrt (fma (* maxCos maxCos) (* (* ux ux) (* (- 1.0 ux) (+ ux -1.0))) 1.0))
        (fma 2.0 (* uy (* PI yi)) xi)
        (* maxCos (* (- 1.0 ux) (* ux zi)))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	return fmaf(sqrtf(fmaf((maxCos * maxCos), ((ux * ux) * ((1.0f - ux) * (ux + -1.0f))), 1.0f)), fmaf(2.0f, (uy * (((float) M_PI) * yi)), xi), (maxCos * ((1.0f - ux) * (ux * zi))));
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	return fma(sqrt(fma(Float32(maxCos * maxCos), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - ux) * Float32(ux + Float32(-1.0)))), Float32(1.0))), fma(Float32(2.0), Float32(uy * Float32(Float32(pi) * yi)), xi), Float32(maxCos * Float32(Float32(Float32(1.0) - ux) * Float32(ux * zi))))
      end
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 98.9%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in uy around 0

        \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + \left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + \color{blue}{\left(xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
        2. associate-+r+N/A

          \[\leadsto \color{blue}{\left(2 \cdot \left(\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        3. associate-*r*N/A

          \[\leadsto \left(\color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} + xi \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
        4. distribute-rgt-outN/A

          \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + xi\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
      5. Simplified80.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \pi\right), xi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)} \]
      6. Final simplification80.8%

        \[\leadsto \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right), maxCos \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)\right) \]
      7. Add Preprocessing

      Alternative 20: 81.2% accurate, 4.3× speedup?

      \[\begin{array}{l} \\ \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(2, uy \cdot \pi, \frac{xi}{yi}\right)\right) \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (+
        (* (* ux (* (- 1.0 ux) maxCos)) zi)
        (*
         yi
         (*
          (sqrt (fma (* maxCos maxCos) (* ux (- ux)) 1.0))
          (fma 2.0 (* uy PI) (/ xi yi))))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	return ((ux * ((1.0f - ux) * maxCos)) * zi) + (yi * (sqrtf(fmaf((maxCos * maxCos), (ux * -ux), 1.0f)) * fmaf(2.0f, (uy * ((float) M_PI)), (xi / yi))));
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	return Float32(Float32(Float32(ux * Float32(Float32(Float32(1.0) - ux) * maxCos)) * zi) + Float32(yi * Float32(sqrt(fma(Float32(maxCos * maxCos), Float32(ux * Float32(-ux)), Float32(1.0))) * fma(Float32(2.0), Float32(uy * Float32(pi)), Float32(xi / yi)))))
      end
      
      \begin{array}{l}
      
      \\
      \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(2, uy \cdot \pi, \frac{xi}{yi}\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 98.9%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Add Preprocessing
      3. Taylor expanded in xi around inf

        \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      4. Step-by-step derivation
        1. *-lowering-*.f32N/A

          \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. distribute-rgt-outN/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        3. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      5. Simplified97.9%

        \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      6. Taylor expanded in yi around inf

        \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. Simplified98.4%

        \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      8. Taylor expanded in ux around 0

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{-1 \cdot {ux}^{2}}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. unpow2N/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. mul-1-negN/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        5. *-lowering-*.f32N/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        6. mul-1-negN/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        7. neg-lowering-neg.f3298.1

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      10. Simplified98.1%

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      11. Taylor expanded in uy around 0

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right) + \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      12. Step-by-step derivation
        1. accelerator-lowering-fma.f32N/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(2, uy \cdot \mathsf{PI}\left(\right), \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. *-lowering-*.f32N/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(2, \color{blue}{uy \cdot \mathsf{PI}\left(\right)}, \frac{xi}{yi}\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        3. PI-lowering-PI.f32N/A

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(\mathsf{neg}\left(ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(2, uy \cdot \color{blue}{\mathsf{PI}\left(\right)}, \frac{xi}{yi}\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        4. /-lowering-/.f3280.3

          \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(2, uy \cdot \pi, \color{blue}{\frac{xi}{yi}}\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      13. Simplified80.3%

        \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \color{blue}{\mathsf{fma}\left(2, uy \cdot \pi, \frac{xi}{yi}\right)}\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      14. Final simplification80.3%

        \[\leadsto \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi + yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)} \cdot \mathsf{fma}\left(2, uy \cdot \pi, \frac{xi}{yi}\right)\right) \]
      15. Add Preprocessing

      Alternative 21: 63.0% accurate, 4.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\ \mathbf{if}\;yi \leq -1.999999987845058 \cdot 10^{-8}:\\ \;\;\;\;uy \cdot \left(yi \cdot t\_0\right)\\ \mathbf{elif}\;yi \leq 9.999999717180685 \cdot 10^{-10}:\\ \;\;\;\;\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(uy \cdot yi\right) \cdot t\_0\\ \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (let* ((t_0
               (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI))))
         (if (<= yi -1.999999987845058e-8)
           (* uy (* yi t_0))
           (if (<= yi 9.999999717180685e-10)
             (fma
              xi
              (sqrt
               (fma (* maxCos maxCos) (* (* ux ux) (* (- 1.0 ux) (+ ux -1.0))) 1.0))
              (* (* ux maxCos) (* (- 1.0 ux) zi)))
             (* (* uy yi) t_0)))))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	float t_0 = fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)));
      	float tmp;
      	if (yi <= -1.999999987845058e-8f) {
      		tmp = uy * (yi * t_0);
      	} else if (yi <= 9.999999717180685e-10f) {
      		tmp = fmaf(xi, sqrtf(fmaf((maxCos * maxCos), ((ux * ux) * ((1.0f - ux) * (ux + -1.0f))), 1.0f)), ((ux * maxCos) * ((1.0f - ux) * zi)));
      	} else {
      		tmp = (uy * yi) * t_0;
      	}
      	return tmp;
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	t_0 = fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))
      	tmp = Float32(0.0)
      	if (yi <= Float32(-1.999999987845058e-8))
      		tmp = Float32(uy * Float32(yi * t_0));
      	elseif (yi <= Float32(9.999999717180685e-10))
      		tmp = fma(xi, sqrt(fma(Float32(maxCos * maxCos), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - ux) * Float32(ux + Float32(-1.0)))), Float32(1.0))), Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi)));
      	else
      		tmp = Float32(Float32(uy * yi) * t_0);
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\
      \mathbf{if}\;yi \leq -1.999999987845058 \cdot 10^{-8}:\\
      \;\;\;\;uy \cdot \left(yi \cdot t\_0\right)\\
      
      \mathbf{elif}\;yi \leq 9.999999717180685 \cdot 10^{-10}:\\
      \;\;\;\;\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(uy \cdot yi\right) \cdot t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if yi < -1.99999999e-8

        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in yi around inf

          \[\leadsto \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        5. Simplified67.0%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
        6. Taylor expanded in uy around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          3. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right)} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          16. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          17. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          18. PI-lowering-PI.f3264.5

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \color{blue}{\pi}\right)\right)\right) \]
        8. Simplified64.5%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]
        9. Taylor expanded in yi around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        10. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          2. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
          16. PI-lowering-PI.f3264.5

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right)\right) \]
        11. Simplified64.5%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)}\right) \]
        12. Taylor expanded in maxCos around 0

          \[\leadsto \color{blue}{1} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        13. Step-by-step derivation
          1. Simplified63.6%

            \[\leadsto \color{blue}{1} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\right) \]

          if -1.99999999e-8 < yi < 9.99999972e-10

          1. Initial program 98.9%

            \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. Add Preprocessing
          3. Applied egg-rr98.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(-\left(1 - ux\right)\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right), 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), yi, \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(ux, \left(-\left(1 - ux\right)\right) \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right), 1\right)}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot xi, \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right)\right)} \]
          4. Taylor expanded in uy around 0

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + xi \cdot \sqrt{1 + {maxCos}^{2} \cdot \left({ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)\right)}} \]
          5. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{xi \cdot \sqrt{1 + {maxCos}^{2} \cdot \left({ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
            2. accelerator-lowering-fma.f32N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \sqrt{1 + {maxCos}^{2} \cdot \left({ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
            3. sqrt-lowering-sqrt.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\sqrt{1 + {maxCos}^{2} \cdot \left({ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)\right)}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            4. +-commutativeN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{{maxCos}^{2} \cdot \left({ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)\right) + 1}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            5. accelerator-lowering-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{\mathsf{fma}\left({maxCos}^{2}, {ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right), 1\right)}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            6. unpow2N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, {ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            7. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, {ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            8. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{{ux}^{2} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            9. unpow2N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            10. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            11. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(ux - 1\right)\right)}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            12. --lowering--.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(1 - ux\right)} \cdot \left(ux - 1\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            13. sub-negN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(\mathsf{neg}\left(1\right)\right)\right)}\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            14. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            15. +-lowering-+.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \color{blue}{\left(ux + -1\right)}\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
          6. Simplified64.2%

            \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]

          if 9.99999972e-10 < yi

          1. Initial program 98.8%

            \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. Add Preprocessing
          3. Taylor expanded in yi around inf

            \[\leadsto \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
            2. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          5. Simplified79.5%

            \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
          6. Taylor expanded in uy around 0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          7. Step-by-step derivation
            1. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
            2. accelerator-lowering-fma.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
            3. associate-*r*N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            4. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            5. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right)} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            6. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            7. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            8. cube-multN/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            9. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            10. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            11. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            12. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            13. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            14. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            15. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            16. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
            17. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
            18. PI-lowering-PI.f3270.6

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \color{blue}{\pi}\right)\right)\right) \]
          8. Simplified70.6%

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]
          9. Taylor expanded in yi around 0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          10. Step-by-step derivation
            1. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
            2. associate-*r*N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            3. accelerator-lowering-fma.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
            4. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            5. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            6. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            7. cube-multN/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            8. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            9. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            10. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            12. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            13. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            14. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            15. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
            16. PI-lowering-PI.f3270.7

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right)\right) \]
          11. Simplified70.7%

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)}\right) \]
          12. Taylor expanded in maxCos around 0

            \[\leadsto \color{blue}{uy \cdot \left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
          13. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
            2. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
            3. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{\left(uy \cdot yi\right)} \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right) \]
            5. accelerator-lowering-fma.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)} \]
            6. *-lowering-*.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            7. unpow2N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            8. *-lowering-*.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            9. cube-multN/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            10. unpow2N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            11. *-lowering-*.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            12. PI-lowering-PI.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            13. unpow2N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            14. *-lowering-*.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
            15. PI-lowering-PI.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
            16. PI-lowering-PI.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
            17. *-lowering-*.f32N/A

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right) \]
            18. PI-lowering-PI.f3270.9

              \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right) \]
          14. Simplified70.9%

            \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)} \]
        14. Recombined 3 regimes into one program.
        15. Final simplification65.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;yi \leq -1.999999987845058 \cdot 10^{-8}:\\ \;\;\;\;uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\ \mathbf{elif}\;yi \leq 9.999999717180685 \cdot 10^{-10}:\\ \;\;\;\;\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\\ \end{array} \]
        16. Add Preprocessing

        Alternative 22: 60.0% accurate, 5.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;xi \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), \pi \cdot \left(2 \cdot yi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (let* ((t_0
                 (fma
                  xi
                  (sqrt (fma (* maxCos maxCos) (* ux (- ux)) 1.0))
                  (* (* ux maxCos) (* (- 1.0 ux) zi)))))
           (if (<= xi -9.999999998199587e-24)
             t_0
             (if (<= xi 4.9999998413276127e-20)
               (*
                uy
                (fma
                 (* -1.3333333333333333 (* uy uy))
                 (* yi (* PI (* PI PI)))
                 (* PI (* 2.0 yi))))
               t_0))))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	float t_0 = fmaf(xi, sqrtf(fmaf((maxCos * maxCos), (ux * -ux), 1.0f)), ((ux * maxCos) * ((1.0f - ux) * zi)));
        	float tmp;
        	if (xi <= -9.999999998199587e-24f) {
        		tmp = t_0;
        	} else if (xi <= 4.9999998413276127e-20f) {
        		tmp = uy * fmaf((-1.3333333333333333f * (uy * uy)), (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))), (((float) M_PI) * (2.0f * yi)));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	t_0 = fma(xi, sqrt(fma(Float32(maxCos * maxCos), Float32(ux * Float32(-ux)), Float32(1.0))), Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi)))
        	tmp = Float32(0.0)
        	if (xi <= Float32(-9.999999998199587e-24))
        		tmp = t_0;
        	elseif (xi <= Float32(4.9999998413276127e-20))
        		tmp = Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))), Float32(Float32(pi) * Float32(Float32(2.0) * yi))));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\
        \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;xi \leq 4.9999998413276127 \cdot 10^{-20}:\\
        \;\;\;\;uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), \pi \cdot \left(2 \cdot yi\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if xi < -1e-23 or 4.99999984e-20 < xi

          1. Initial program 99.2%

            \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. Add Preprocessing
          3. Taylor expanded in xi around inf

            \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          4. Step-by-step derivation
            1. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{xi \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi} \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            2. distribute-rgt-outN/A

              \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            3. *-lowering-*.f32N/A

              \[\leadsto xi \cdot \color{blue}{\left(\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{xi}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          5. Simplified98.9%

            \[\leadsto \color{blue}{xi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \frac{yi}{xi}, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          6. Taylor expanded in yi around inf

            \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          7. Simplified98.5%

            \[\leadsto \color{blue}{yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          8. Taylor expanded in ux around 0

            \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{-1 \cdot {ux}^{2}}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          9. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            2. unpow2N/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            3. distribute-rgt-neg-inN/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            4. mul-1-negN/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            5. *-lowering-*.f32N/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-1 \cdot ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            6. mul-1-negN/A

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
            7. neg-lowering-neg.f3298.6

              \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \color{blue}{\left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          10. Simplified98.6%

            \[\leadsto yi \cdot \left(\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{ux \cdot \left(-ux\right)}, 1\right)} \cdot \mathsf{fma}\left(xi, \frac{\cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          11. Taylor expanded in uy around 0

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right)}} \]
          12. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{xi \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
            2. accelerator-lowering-fma.f32N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
            3. sqrt-lowering-sqrt.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right)}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            4. +-commutativeN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{-1 \cdot \left({maxCos}^{2} \cdot {ux}^{2}\right) + 1}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            5. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{\left(\mathsf{neg}\left({maxCos}^{2} \cdot {ux}^{2}\right)\right)} + 1}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            6. distribute-rgt-neg-inN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{{maxCos}^{2} \cdot \left(\mathsf{neg}\left({ux}^{2}\right)\right)} + 1}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            7. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2}\right)} + 1}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            8. accelerator-lowering-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\color{blue}{\mathsf{fma}\left({maxCos}^{2}, -1 \cdot {ux}^{2}, 1\right)}}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            9. unpow2N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, -1 \cdot {ux}^{2}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            10. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(\color{blue}{maxCos \cdot maxCos}, -1 \cdot {ux}^{2}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            11. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            12. neg-lowering-neg.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \color{blue}{\mathsf{neg}\left({ux}^{2}\right)}, 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            13. unpow2N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            14. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(\color{blue}{ux \cdot ux}\right), 1\right)}, maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            15. associate-*r*N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(ux \cdot ux\right), 1\right)}, \color{blue}{\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)}\right) \]
            16. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(ux \cdot ux\right), 1\right)}, \color{blue}{\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)}\right) \]
            17. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(ux \cdot ux\right), 1\right)}, \color{blue}{\left(maxCos \cdot ux\right)} \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \]
            18. *-lowering-*.f32N/A

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \mathsf{neg}\left(ux \cdot ux\right), 1\right)}, \left(maxCos \cdot ux\right) \cdot \color{blue}{\left(zi \cdot \left(1 - ux\right)\right)}\right) \]
            19. --lowering--.f3266.2

              \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, -ux \cdot ux, 1\right)}, \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \color{blue}{\left(1 - ux\right)}\right)\right) \]
          13. Simplified66.2%

            \[\leadsto \color{blue}{\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, -ux \cdot ux, 1\right)}, \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]

          if -1e-23 < xi < 4.99999984e-20

          1. Initial program 98.5%

            \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
          2. Add Preprocessing
          3. Taylor expanded in yi around inf

            \[\leadsto \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
            2. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          5. Simplified68.8%

            \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
          6. Taylor expanded in uy around 0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          7. Step-by-step derivation
            1. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
            2. accelerator-lowering-fma.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
            3. associate-*r*N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            4. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            5. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right)} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            6. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            7. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            8. cube-multN/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            9. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            10. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            11. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            12. unpow2N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            13. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            14. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            15. PI-lowering-PI.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            16. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
            17. *-lowering-*.f32N/A

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
            18. PI-lowering-PI.f3263.9

              \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \color{blue}{\pi}\right)\right)\right) \]
          8. Simplified63.9%

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]
          9. Taylor expanded in maxCos around 0

            \[\leadsto \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
          10. Step-by-step derivation
            1. *-lowering-*.f32N/A

              \[\leadsto \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
            2. associate-*r*N/A

              \[\leadsto uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)} + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            3. accelerator-lowering-fma.f32N/A

              \[\leadsto uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, yi \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
            4. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, yi \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            5. unpow2N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, yi \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            6. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, yi \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            7. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{yi \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            8. cube-multN/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            9. unpow2N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            10. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            11. PI-lowering-PI.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            12. unpow2N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            13. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            14. PI-lowering-PI.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            15. PI-lowering-PI.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            16. associate-*r*N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(2 \cdot yi\right) \cdot \mathsf{PI}\left(\right)}\right) \]
            17. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(2 \cdot yi\right) \cdot \mathsf{PI}\left(\right)}\right) \]
            18. *-lowering-*.f32N/A

              \[\leadsto uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), yi \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(2 \cdot yi\right)} \cdot \mathsf{PI}\left(\right)\right) \]
            19. PI-lowering-PI.f3263.6

              \[\leadsto uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), \left(2 \cdot yi\right) \cdot \color{blue}{\pi}\right) \]
          11. Simplified63.6%

            \[\leadsto \color{blue}{uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), \left(2 \cdot yi\right) \cdot \pi\right)} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification65.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;xi \leq -9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \mathbf{elif}\;xi \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), \pi \cdot \left(2 \cdot yi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, ux \cdot \left(-ux\right), 1\right)}, \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 23: 35.7% accurate, 8.4× speedup?

        \[\begin{array}{l} \\ \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (*
          (* uy yi)
          (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI))))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	return (uy * yi) * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)));
        }
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	return Float32(Float32(uy * yi) * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi))))
        end
        
        \begin{array}{l}
        
        \\
        \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in yi around inf

          \[\leadsto \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\sqrt{1 - {maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        5. Simplified41.1%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
        6. Taylor expanded in uy around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
          2. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          3. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \color{blue}{\left({uy}^{2} \cdot yi\right)} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\color{blue}{\left(uy \cdot uy\right)} \cdot yi\right) \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          16. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          17. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          18. PI-lowering-PI.f3238.0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \color{blue}{\pi}\right)\right)\right) \]
        8. Simplified38.0%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(\left(uy \cdot uy\right) \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]
        9. Taylor expanded in yi around 0

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        10. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
          2. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          3. accelerator-lowering-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
          4. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          5. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          6. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          9. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          10. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          12. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          13. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          14. PI-lowering-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          15. *-lowering-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
          16. PI-lowering-PI.f3238.0

            \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right)\right) \]
        11. Simplified38.0%

          \[\leadsto \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot \left(-ux\right)\right), 1\right)} \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)}\right) \]
        12. Taylor expanded in maxCos around 0

          \[\leadsto \color{blue}{uy \cdot \left(yi \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        13. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(uy \cdot yi\right)} \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right) \]
          5. accelerator-lowering-fma.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)} \]
          6. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          7. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          8. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          9. cube-multN/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          10. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          11. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          12. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          13. unpow2N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          14. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right) \]
          15. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
          16. PI-lowering-PI.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right) \]
          17. *-lowering-*.f32N/A

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right) \]
          18. PI-lowering-PI.f3237.9

            \[\leadsto \left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right) \]
        14. Simplified37.9%

          \[\leadsto \color{blue}{\left(uy \cdot yi\right) \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)} \]
        15. Add Preprocessing

        Alternative 24: 13.0% accurate, 18.6× speedup?

        \[\begin{array}{l} \\ \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (* (* ux maxCos) (* (- 1.0 ux) zi)))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	return (ux * maxCos) * ((1.0f - ux) * zi);
        }
        
        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 = (ux * maxcos) * ((1.0e0 - ux) * zi)
        end function
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	return Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi))
        end
        
        function tmp = code(xi, yi, zi, ux, uy, maxCos)
        	tmp = (ux * maxCos) * ((single(1.0) - ux) * zi);
        end
        
        \begin{array}{l}
        
        \\
        \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in zi around inf

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right) \]
          5. --lowering--.f3213.7

            \[\leadsto maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \color{blue}{\left(1 - ux\right)}\right) \]
        5. Simplified13.7%

          \[\leadsto \color{blue}{maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(ux \cdot zi\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto \color{blue}{\left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right)} \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\left(1 - ux\right) \cdot maxCos\right)} \cdot \left(ux \cdot zi\right) \]
          4. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi} \]
          5. *-commutativeN/A

            \[\leadsto \color{blue}{zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \]
          6. associate-*l*N/A

            \[\leadsto zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)} \]
          7. associate-*r*N/A

            \[\leadsto \color{blue}{\left(zi \cdot \left(1 - ux\right)\right) \cdot \left(maxCos \cdot ux\right)} \]
          8. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(zi \cdot \left(1 - ux\right)\right) \cdot \left(maxCos \cdot ux\right)} \]
          9. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)} \cdot \left(maxCos \cdot ux\right) \]
          10. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)} \cdot \left(maxCos \cdot ux\right) \]
          11. --lowering--.f32N/A

            \[\leadsto \left(\color{blue}{\left(1 - ux\right)} \cdot zi\right) \cdot \left(maxCos \cdot ux\right) \]
          12. *-commutativeN/A

            \[\leadsto \left(\left(1 - ux\right) \cdot zi\right) \cdot \color{blue}{\left(ux \cdot maxCos\right)} \]
          13. *-lowering-*.f3213.7

            \[\leadsto \left(\left(1 - ux\right) \cdot zi\right) \cdot \color{blue}{\left(ux \cdot maxCos\right)} \]
        7. Applied egg-rr13.7%

          \[\leadsto \color{blue}{\left(\left(1 - ux\right) \cdot zi\right) \cdot \left(ux \cdot maxCos\right)} \]
        8. Final simplification13.7%

          \[\leadsto \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right) \]
        9. Add Preprocessing

        Alternative 25: 13.0% accurate, 18.6× speedup?

        \[\begin{array}{l} \\ maxCos \cdot \left(ux \cdot \mathsf{fma}\left(ux, -zi, zi\right)\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (* maxCos (* ux (fma ux (- zi) zi))))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	return maxCos * (ux * fmaf(ux, -zi, zi));
        }
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	return Float32(maxCos * Float32(ux * fma(ux, Float32(-zi), zi)))
        end
        
        \begin{array}{l}
        
        \\
        maxCos \cdot \left(ux \cdot \mathsf{fma}\left(ux, -zi, zi\right)\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in zi around inf

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right) \]
          5. --lowering--.f3213.7

            \[\leadsto maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \color{blue}{\left(1 - ux\right)}\right) \]
        5. Simplified13.7%

          \[\leadsto \color{blue}{maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
        6. Taylor expanded in ux around 0

          \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot \left(zi + -1 \cdot \left(ux \cdot zi\right)\right)\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot \left(zi + -1 \cdot \left(ux \cdot zi\right)\right)\right)} \]
          2. +-commutativeN/A

            \[\leadsto maxCos \cdot \left(ux \cdot \color{blue}{\left(-1 \cdot \left(ux \cdot zi\right) + zi\right)}\right) \]
          3. mul-1-negN/A

            \[\leadsto maxCos \cdot \left(ux \cdot \left(\color{blue}{\left(\mathsf{neg}\left(ux \cdot zi\right)\right)} + zi\right)\right) \]
          4. distribute-rgt-neg-inN/A

            \[\leadsto maxCos \cdot \left(ux \cdot \left(\color{blue}{ux \cdot \left(\mathsf{neg}\left(zi\right)\right)} + zi\right)\right) \]
          5. mul-1-negN/A

            \[\leadsto maxCos \cdot \left(ux \cdot \left(ux \cdot \color{blue}{\left(-1 \cdot zi\right)} + zi\right)\right) \]
          6. accelerator-lowering-fma.f32N/A

            \[\leadsto maxCos \cdot \left(ux \cdot \color{blue}{\mathsf{fma}\left(ux, -1 \cdot zi, zi\right)}\right) \]
          7. mul-1-negN/A

            \[\leadsto maxCos \cdot \left(ux \cdot \mathsf{fma}\left(ux, \color{blue}{\mathsf{neg}\left(zi\right)}, zi\right)\right) \]
          8. neg-lowering-neg.f3213.7

            \[\leadsto maxCos \cdot \left(ux \cdot \mathsf{fma}\left(ux, \color{blue}{-zi}, zi\right)\right) \]
        8. Simplified13.7%

          \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot \mathsf{fma}\left(ux, -zi, zi\right)\right)} \]
        9. Add Preprocessing

        Alternative 26: 11.7% accurate, 32.1× speedup?

        \[\begin{array}{l} \\ zi \cdot \left(ux \cdot maxCos\right) \end{array} \]
        (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(zi * Float32(ux * maxCos))
        end
        
        function tmp = code(xi, yi, zi, ux, uy, maxCos)
        	tmp = zi * (ux * maxCos);
        end
        
        \begin{array}{l}
        
        \\
        zi \cdot \left(ux \cdot maxCos\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in zi around inf

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right) \]
          5. --lowering--.f3213.7

            \[\leadsto maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \color{blue}{\left(1 - ux\right)}\right) \]
        5. Simplified13.7%

          \[\leadsto \color{blue}{maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
        6. Taylor expanded in ux around 0

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
          2. *-lowering-*.f3212.1

            \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot zi\right)} \]
        8. Simplified12.1%

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        9. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \color{blue}{\left(maxCos \cdot ux\right) \cdot zi} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(maxCos \cdot ux\right) \cdot zi} \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\left(ux \cdot maxCos\right)} \cdot zi \]
          4. *-lowering-*.f3212.1

            \[\leadsto \color{blue}{\left(ux \cdot maxCos\right)} \cdot zi \]
        10. Applied egg-rr12.1%

          \[\leadsto \color{blue}{\left(ux \cdot maxCos\right) \cdot zi} \]
        11. Final simplification12.1%

          \[\leadsto zi \cdot \left(ux \cdot maxCos\right) \]
        12. Add Preprocessing

        Alternative 27: 11.7% accurate, 32.1× speedup?

        \[\begin{array}{l} \\ ux \cdot \left(maxCos \cdot zi\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos) :precision binary32 (* ux (* maxCos zi)))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	return ux * (maxCos * zi);
        }
        
        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 = ux * (maxcos * zi)
        end function
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	return Float32(ux * Float32(maxCos * zi))
        end
        
        function tmp = code(xi, yi, zi, ux, uy, maxCos)
        	tmp = ux * (maxCos * zi);
        end
        
        \begin{array}{l}
        
        \\
        ux \cdot \left(maxCos \cdot zi\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in zi around inf

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right) \]
          5. --lowering--.f3213.7

            \[\leadsto maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \color{blue}{\left(1 - ux\right)}\right) \]
        5. Simplified13.7%

          \[\leadsto \color{blue}{maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
        6. Taylor expanded in ux around 0

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
          2. *-lowering-*.f3212.1

            \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot zi\right)} \]
        8. Simplified12.1%

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        9. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto maxCos \cdot \color{blue}{\left(zi \cdot ux\right)} \]
          2. associate-*r*N/A

            \[\leadsto \color{blue}{\left(maxCos \cdot zi\right) \cdot ux} \]
          3. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{\left(maxCos \cdot zi\right) \cdot ux} \]
          4. *-lowering-*.f3212.1

            \[\leadsto \color{blue}{\left(maxCos \cdot zi\right)} \cdot ux \]
        10. Applied egg-rr12.1%

          \[\leadsto \color{blue}{\left(maxCos \cdot zi\right) \cdot ux} \]
        11. Final simplification12.1%

          \[\leadsto ux \cdot \left(maxCos \cdot zi\right) \]
        12. Add Preprocessing

        Alternative 28: 11.7% accurate, 32.1× speedup?

        \[\begin{array}{l} \\ maxCos \cdot \left(ux \cdot zi\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos) :precision binary32 (* maxCos (* ux zi)))
        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
        	return maxCos * (ux * zi);
        }
        
        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 = maxcos * (ux * zi)
        end function
        
        function code(xi, yi, zi, ux, uy, maxCos)
        	return Float32(maxCos * Float32(ux * zi))
        end
        
        function tmp = code(xi, yi, zi, ux, uy, maxCos)
        	tmp = maxCos * (ux * zi);
        end
        
        \begin{array}{l}
        
        \\
        maxCos \cdot \left(ux \cdot zi\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Add Preprocessing
        3. Taylor expanded in zi around inf

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          3. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right) \]
          5. --lowering--.f3213.7

            \[\leadsto maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \color{blue}{\left(1 - ux\right)}\right) \]
        5. Simplified13.7%

          \[\leadsto \color{blue}{maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)} \]
        6. Taylor expanded in ux around 0

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        7. Step-by-step derivation
          1. *-lowering-*.f32N/A

            \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
          2. *-lowering-*.f3212.1

            \[\leadsto maxCos \cdot \color{blue}{\left(ux \cdot zi\right)} \]
        8. Simplified12.1%

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
        9. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2024198 
        (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)))