UniformSampleCone 2

Percentage Accurate: 98.9% → 98.8%
Time: 19.1s
Alternatives: 20
Speedup: N/A×

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 20 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.8% accurate, 1.4× 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, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\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) (* maxCos (* (* ux zi) (- 1.0 ux)))))))
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), (maxCos * ((ux * zi) * (1.0f - ux)))));
}
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(maxCos * Float32(Float32(ux * zi) * Float32(Float32(1.0) - ux)))))
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, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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. Taylor expanded in maxCos around 0

    \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
    14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
    15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
    16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
  5. Simplified98.9%

    \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
  6. Add Preprocessing

Alternative 2: 96.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := uy \cdot \left(2 \cdot \pi\right)\\ \mathbf{if}\;2 \cdot uy \leq 0.16599999368190765:\\ \;\;\;\;\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \mathsf{fma}\left(\cos t\_0, \frac{xi}{yi}, \sin t\_0\right)\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* uy (* 2.0 PI))))
   (if (<= (* 2.0 uy) 0.16599999368190765)
     (fma
      xi
      (cos (* 2.0 (* uy PI)))
      (fma
       yi
       (*
        uy
        (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI)))
       (* maxCos (* (* ux zi) (- 1.0 ux)))))
     (* yi (fma (cos t_0) (/ xi yi) (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 tmp;
	if ((2.0f * uy) <= 0.16599999368190765f) {
		tmp = fmaf(xi, cosf((2.0f * (uy * ((float) M_PI)))), fmaf(yi, (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)))), (maxCos * ((ux * zi) * (1.0f - ux)))));
	} else {
		tmp = yi * fmaf(cosf(t_0), (xi / yi), sinf(t_0));
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(uy * Float32(Float32(2.0) * Float32(pi)))
	tmp = Float32(0.0)
	if (Float32(Float32(2.0) * uy) <= Float32(0.16599999368190765))
		tmp = fma(xi, cos(Float32(Float32(2.0) * Float32(uy * Float32(pi)))), fma(yi, Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))), Float32(maxCos * Float32(Float32(ux * zi) * Float32(Float32(1.0) - ux)))));
	else
		tmp = Float32(yi * fma(cos(t_0), Float32(xi / yi), sin(t_0)));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := uy \cdot \left(2 \cdot \pi\right)\\
\mathbf{if}\;2 \cdot uy \leq 0.16599999368190765:\\
\;\;\;\;\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;yi \cdot \mathsf{fma}\left(\cos t\_0, \frac{xi}{yi}, \sin t\_0\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.165999994

    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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified99.3%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Taylor expanded in uy around 0

      \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-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, \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      2. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      3. accelerator-lowering-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      4. *-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, uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      7. cube-multN/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      10. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      12. *-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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      13. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      14. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      15. *-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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      16. PI-lowering-PI.f3298.6

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Simplified98.6%

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

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

    1. Initial program 96.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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified96.4%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Taylor expanded in yi around -inf

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

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

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

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

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

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

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

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

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

        \[\leadsto yi \cdot \color{blue}{\left(\frac{xi \cdot \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)} \]
      3. *-commutativeN/A

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

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

        \[\leadsto yi \cdot \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \frac{xi}{yi}, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    11. Simplified87.2%

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

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

Alternative 3: 96.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ t_1 := \cos t\_0\\ \mathbf{if}\;2 \cdot uy \leq 0.16599999368190765:\\ \;\;\;\;\mathsf{fma}\left(xi, t\_1, \mathsf{fma}\left(yi, uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(xi, t\_1, 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 (cos t_0)))
   (if (<= (* 2.0 uy) 0.16599999368190765)
     (fma
      xi
      t_1
      (fma
       yi
       (*
        uy
        (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI)))
       (* maxCos (* (* ux zi) (- 1.0 ux)))))
     (fma xi t_1 (* 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 = cosf(t_0);
	float tmp;
	if ((2.0f * uy) <= 0.16599999368190765f) {
		tmp = fmaf(xi, t_1, fmaf(yi, (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)))), (maxCos * ((ux * zi) * (1.0f - ux)))));
	} else {
		tmp = fmaf(xi, t_1, (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 = cos(t_0)
	tmp = Float32(0.0)
	if (Float32(Float32(2.0) * uy) <= Float32(0.16599999368190765))
		tmp = fma(xi, t_1, fma(yi, Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))), Float32(maxCos * Float32(Float32(ux * zi) * Float32(Float32(1.0) - ux)))));
	else
		tmp = fma(xi, t_1, 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 := \cos t\_0\\
\mathbf{if}\;2 \cdot uy \leq 0.16599999368190765:\\
\;\;\;\;\mathsf{fma}\left(xi, t\_1, \mathsf{fma}\left(yi, uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(xi, t\_1, 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.165999994

    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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified99.3%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Taylor expanded in uy around 0

      \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    7. Step-by-step derivation
      1. *-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, \color{blue}{uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      2. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      3. accelerator-lowering-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      4. *-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, uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      7. cube-multN/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      10. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      12. *-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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      13. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      14. 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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      15. *-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, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      16. PI-lowering-PI.f3298.6

        \[\leadsto \mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, uy \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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Simplified98.6%

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

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

    1. Initial program 96.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 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.f3287.2

        \[\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. Simplified87.2%

      \[\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 simplification97.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.16599999368190765:\\ \;\;\;\;\mathsf{fma}\left(xi, \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), \mathsf{fma}\left(yi, uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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 4: 95.7% 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(maxCos \cdot ux\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 (* maxCos ux))))))
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 * (maxCos * ux))));
}
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(maxCos * ux))))
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(maxCos \cdot ux\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-*.f3296.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. Simplified96.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 simplification96.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(maxCos \cdot ux\right)\right)\right) \]
  7. Add Preprocessing

Alternative 5: 93.1% accurate, 2.2× speedup?

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

\\
\mathsf{fma}\left(xi, \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \pi \cdot \pi, 1\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\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 maxCos around 0

    \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
    14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
    15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
    16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
  5. Simplified98.9%

    \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
  6. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 92.1% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.08299999684095383:\\ \;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, yi \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(xi, 1, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (if (<= (* 2.0 uy) 0.08299999684095383)
   (fma
    uy
    (fma
     uy
     (fma
      -1.3333333333333333
      (* yi (* uy (* PI (* PI PI))))
      (* (* PI PI) (* xi -2.0)))
     (* 2.0 (* PI yi)))
    (fma (fma zi (- ux) zi) (* maxCos ux) xi))
   (fma
    xi
    1.0
    (fma yi (sin (* 2.0 (* uy PI))) (* maxCos (* (* ux zi) (- 1.0 ux)))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float tmp;
	if ((2.0f * uy) <= 0.08299999684095383f) {
		tmp = fmaf(uy, fmaf(uy, fmaf(-1.3333333333333333f, (yi * (uy * (((float) M_PI) * (((float) M_PI) * ((float) M_PI))))), ((((float) M_PI) * ((float) M_PI)) * (xi * -2.0f))), (2.0f * (((float) M_PI) * yi))), fmaf(fmaf(zi, -ux, zi), (maxCos * ux), xi));
	} else {
		tmp = fmaf(xi, 1.0f, fmaf(yi, sinf((2.0f * (uy * ((float) M_PI)))), (maxCos * ((ux * zi) * (1.0f - ux)))));
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	tmp = Float32(0.0)
	if (Float32(Float32(2.0) * uy) <= Float32(0.08299999684095383))
		tmp = fma(uy, fma(uy, fma(Float32(-1.3333333333333333), Float32(yi * Float32(uy * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))), Float32(Float32(Float32(pi) * Float32(pi)) * Float32(xi * Float32(-2.0)))), Float32(Float32(2.0) * Float32(Float32(pi) * yi))), fma(fma(zi, Float32(-ux), zi), Float32(maxCos * ux), xi));
	else
		tmp = fma(xi, Float32(1.0), fma(yi, sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))), Float32(maxCos * Float32(Float32(ux * zi) * Float32(Float32(1.0) - ux)))));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;2 \cdot uy \leq 0.08299999684095383:\\
\;\;\;\;\mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, yi \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(xi, 1, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.0829999968

    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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified99.3%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)}, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. sqr-sin-aN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \mathsf{neg}\left(e^{\log \sin \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot 2}\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      9. PI-lowering-PI.f3299.2

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -e^{\log \sin \left(uy \cdot \color{blue}{\pi}\right) \cdot 2}\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    9. Applied egg-rr99.2%

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

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

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

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

    1. Initial program 96.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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified96.8%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Taylor expanded in uy around 0

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

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

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

    Alternative 7: 91.1% accurate, 2.4× speedup?

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

      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 maxCos around 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
        13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
        14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. Simplified99.3%

        \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
      6. Step-by-step derivation
        1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)}, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      8. Step-by-step derivation
        1. sqr-sin-aN/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \mathsf{neg}\left(e^{\log \sin \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot 2}\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
        9. PI-lowering-PI.f3299.2

          \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -e^{\log \sin \left(uy \cdot \color{blue}{\pi}\right) \cdot 2}\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      9. Applied egg-rr99.2%

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

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

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

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

      1. Initial program 96.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 maxCos around 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
        13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
        14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. Simplified96.7%

        \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
      6. Taylor expanded in xi around 0

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

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

          \[\leadsto \mathsf{fma}\left(maxCos, \color{blue}{ux \cdot \left(zi \cdot \left(1 - ux\right)\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)}, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        4. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(maxCos, ux \cdot \mathsf{fma}\left(ux, \mathsf{neg}\left(zi\right), zi\right), yi \cdot \sin \left(\color{blue}{\left(2 \cdot uy\right)} \cdot \mathsf{PI}\left(\right)\right)\right) \]
        20. PI-lowering-PI.f3260.7

          \[\leadsto \mathsf{fma}\left(maxCos, ux \cdot \mathsf{fma}\left(ux, -zi, zi\right), yi \cdot \sin \left(\left(2 \cdot uy\right) \cdot \color{blue}{\pi}\right)\right) \]
      8. Simplified60.7%

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

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

    Alternative 8: 89.5% accurate, 4.2× speedup?

    \[\begin{array}{l} \\ xi + \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \left(maxCos \cdot ux\right) \cdot \mathsf{fma}\left(ux, -zi, zi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (+
      xi
      (fma
       uy
       (fma
        uy
        (fma
         -1.3333333333333333
         (* uy (* yi (* PI (* PI PI))))
         (* (* PI PI) (* xi -2.0)))
        (* 2.0 (* PI yi)))
       (* (* maxCos ux) (fma ux (- zi) zi)))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return xi + fmaf(uy, fmaf(uy, fmaf(-1.3333333333333333f, (uy * (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI))))), ((((float) M_PI) * ((float) M_PI)) * (xi * -2.0f))), (2.0f * (((float) M_PI) * yi))), ((maxCos * ux) * fmaf(ux, -zi, zi)));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(xi + fma(uy, fma(uy, fma(Float32(-1.3333333333333333), Float32(uy * Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))), Float32(Float32(Float32(pi) * Float32(pi)) * Float32(xi * Float32(-2.0)))), Float32(Float32(2.0) * Float32(Float32(pi) * yi))), Float32(Float32(maxCos * ux) * fma(ux, Float32(-zi), zi))))
    end
    
    \begin{array}{l}
    
    \\
    xi + \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \left(maxCos \cdot ux\right) \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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Taylor expanded in uy around 0

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

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

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

    Alternative 9: 89.5% accurate, 4.3× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, yi \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma
      uy
      (fma
       uy
       (fma
        -1.3333333333333333
        (* yi (* uy (* PI (* PI PI))))
        (* (* PI PI) (* xi -2.0)))
       (* 2.0 (* PI yi)))
      (fma (fma zi (- ux) zi) (* maxCos ux) xi)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(uy, fmaf(uy, fmaf(-1.3333333333333333f, (yi * (uy * (((float) M_PI) * (((float) M_PI) * ((float) M_PI))))), ((((float) M_PI) * ((float) M_PI)) * (xi * -2.0f))), (2.0f * (((float) M_PI) * yi))), fmaf(fmaf(zi, -ux, zi), (maxCos * ux), xi));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(uy, fma(uy, fma(Float32(-1.3333333333333333), Float32(yi * Float32(uy * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))), Float32(Float32(Float32(pi) * Float32(pi)) * Float32(xi * Float32(-2.0)))), Float32(Float32(2.0) * Float32(Float32(pi) * yi))), fma(fma(zi, Float32(-ux), zi), Float32(maxCos * ux), xi))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \mathsf{fma}\left(-1.3333333333333333, yi \cdot \left(uy \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right), \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right)\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)}, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. sqr-sin-aN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \mathsf{neg}\left(e^{\log \sin \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot 2}\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      9. PI-lowering-PI.f3298.8

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -e^{\log \sin \left(uy \cdot \color{blue}{\pi}\right) \cdot 2}\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    9. Applied egg-rr98.8%

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

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

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

    Alternative 10: 85.9% accurate, 6.2× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma
      uy
      (fma uy (* (* PI PI) (* xi -2.0)) (* 2.0 (* PI yi)))
      (fma (fma zi (- ux) zi) (* maxCos ux) xi)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(uy, fmaf(uy, ((((float) M_PI) * ((float) M_PI)) * (xi * -2.0f)), (2.0f * (((float) M_PI) * yi))), fmaf(fmaf(zi, -ux, zi), (maxCos * ux), xi));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(uy, fma(uy, Float32(Float32(Float32(pi) * Float32(pi)) * Float32(xi * Float32(-2.0))), Float32(Float32(2.0) * Float32(Float32(pi) * yi))), fma(fma(zi, Float32(-ux), zi), Float32(maxCos * ux), xi))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(uy, \mathsf{fma}\left(uy, \left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right), 2 \cdot \left(\pi \cdot yi\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)}, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. sqr-sin-aN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \mathsf{neg}\left(e^{\log \sin \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot 2}\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      9. PI-lowering-PI.f3298.8

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -e^{\log \sin \left(uy \cdot \color{blue}{\pi}\right) \cdot 2}\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    9. Applied egg-rr98.8%

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

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

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

    Alternative 11: 85.9% accurate, 6.2× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(uy \cdot -2\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\right), \mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma
      uy
      (fma 2.0 (* PI yi) (* (* uy -2.0) (* xi (* PI PI))))
      (fma (* maxCos ux) (* zi (- 1.0 ux)) xi)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(uy, fmaf(2.0f, (((float) M_PI) * yi), ((uy * -2.0f) * (xi * (((float) M_PI) * ((float) M_PI))))), fmaf((maxCos * ux), (zi * (1.0f - ux)), xi));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(uy, fma(Float32(2.0), Float32(Float32(pi) * yi), Float32(Float32(uy * Float32(-2.0)) * Float32(xi * Float32(Float32(pi) * Float32(pi))))), fma(Float32(maxCos * ux), Float32(zi * Float32(Float32(1.0) - ux)), xi))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(uy, \mathsf{fma}\left(2, \pi \cdot yi, \left(uy \cdot -2\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\right), \mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 12: 81.9% accurate, 9.8× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(uy, 2 \cdot \left(\pi \cdot yi\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma uy (* 2.0 (* PI yi)) (fma (fma zi (- ux) zi) (* maxCos ux) xi)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(uy, (2.0f * (((float) M_PI) * yi)), fmaf(fmaf(zi, -ux, zi), (maxCos * ux), xi));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(uy, Float32(Float32(2.0) * Float32(Float32(pi) * yi)), fma(fma(zi, Float32(-ux), zi), Float32(maxCos * ux), xi))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(uy, 2 \cdot \left(\pi \cdot yi\right), \mathsf{fma}\left(\mathsf{fma}\left(zi, -ux, zi\right), maxCos \cdot ux, xi\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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(xi, \color{blue}{\mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)}, \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. sqr-sin-aN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \cos \left(uy \cdot \mathsf{PI}\left(\right)\right), \mathsf{neg}\left(e^{\log \sin \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot 2}\right)\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
      9. PI-lowering-PI.f3298.8

        \[\leadsto \mathsf{fma}\left(xi, \mathsf{fma}\left(\cos \left(uy \cdot \pi\right), \cos \left(uy \cdot \pi\right), -e^{\log \sin \left(uy \cdot \color{blue}{\pi}\right) \cdot 2}\right), \mathsf{fma}\left(yi, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right) \]
    9. Applied egg-rr98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(uy, 2 \cdot \left(\mathsf{PI}\left(\right) \cdot yi\right), \color{blue}{\mathsf{fma}\left(zi \cdot \left(1 - ux\right), maxCos \cdot ux, xi\right)}\right) \]
    12. Simplified83.1%

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

    Alternative 13: 81.9% accurate, 9.8× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), \mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\right)\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (fma 2.0 (* uy (* PI yi)) (fma (* maxCos ux) (* zi (- 1.0 ux)) xi)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return fmaf(2.0f, (uy * (((float) M_PI) * yi)), fmaf((maxCos * ux), (zi * (1.0f - ux)), xi));
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return fma(Float32(2.0), Float32(uy * Float32(Float32(pi) * yi)), fma(Float32(maxCos * ux), Float32(zi * Float32(Float32(1.0) - ux)), xi))
    end
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), \mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\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 maxCos around 0

      \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
      13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
      14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
      16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Simplified98.9%

      \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. cos-2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(2, uy \cdot \left(\mathsf{PI}\left(\right) \cdot yi\right), \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, xi\right)\right) \]
      14. --lowering--.f3283.0

        \[\leadsto \mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), \mathsf{fma}\left(maxCos \cdot ux, zi \cdot \color{blue}{\left(1 - ux\right)}, xi\right)\right) \]
    10. Simplified83.0%

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

    Alternative 14: 74.4% accurate, 10.7× speedup?

    \[\begin{array}{l} \\ xi \cdot \mathsf{fma}\left(2, \frac{uy \cdot \left(\pi \cdot yi\right)}{xi}, 1\right) \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (* xi (fma 2.0 (/ (* uy (* PI yi)) xi) 1.0)))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	return xi * fmaf(2.0f, ((uy * (((float) M_PI) * yi)) / xi), 1.0f);
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	return Float32(xi * fma(Float32(2.0), Float32(Float32(uy * Float32(Float32(pi) * yi)) / xi), Float32(1.0)))
    end
    
    \begin{array}{l}
    
    \\
    xi \cdot \mathsf{fma}\left(2, \frac{uy \cdot \left(\pi \cdot yi\right)}{xi}, 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. Simplified98.3%

      \[\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 ux\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 \color{blue}{\left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + 2 \cdot \left(\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto xi \cdot \left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \color{blue}{\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}\right) \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 \]
      2. distribute-rgt1-inN/A

        \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
      3. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
      4. accelerator-lowering-fma.f32N/A

        \[\leadsto xi \cdot \left(\color{blue}{\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right)} \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 \]
      5. /-lowering-/.f32N/A

        \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \color{blue}{\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}}, 1\right) \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 \]
      6. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{\color{blue}{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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. *-lowering-*.f32N/A

        \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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 \]
      8. PI-lowering-PI.f32N/A

        \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{xi}, 1\right) \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 \]
      9. sqrt-lowering-sqrt.f32N/A

        \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right) \cdot \color{blue}{\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 \]
    8. Simplified82.8%

      \[\leadsto xi \cdot \color{blue}{\left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \pi\right)}{xi}, 1\right) \cdot \sqrt{\mathsf{fma}\left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right), maxCos \cdot \left(-maxCos\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}{xi \cdot \left(1 + 2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}\right)} \]
    10. Step-by-step derivation
      1. *-lowering-*.f32N/A

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

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

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

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

        \[\leadsto xi \cdot \mathsf{fma}\left(2, \frac{\color{blue}{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \]
      6. *-commutativeN/A

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

        \[\leadsto xi \cdot \mathsf{fma}\left(2, \frac{uy \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot yi\right)}}{xi}, 1\right) \]
      8. PI-lowering-PI.f3275.7

        \[\leadsto xi \cdot \mathsf{fma}\left(2, \frac{uy \cdot \left(\color{blue}{\pi} \cdot yi\right)}{xi}, 1\right) \]
    11. Simplified75.7%

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

    Alternative 15: 61.9% accurate, 11.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\ \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, \mathsf{fma}\left(ux, -zi, zi\right), xi\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* uy (* 2.0 (* PI yi)))))
       (if (<= yi -9.999999960041972e-12)
         t_0
         (if (<= yi 1.99999996490334e-14)
           (fma (* maxCos ux) (fma ux (- zi) zi) xi)
           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) * yi));
    	float tmp;
    	if (yi <= -9.999999960041972e-12f) {
    		tmp = t_0;
    	} else if (yi <= 1.99999996490334e-14f) {
    		tmp = fmaf((maxCos * ux), fmaf(ux, -zi, zi), xi);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = Float32(uy * Float32(Float32(2.0) * Float32(Float32(pi) * yi)))
    	tmp = Float32(0.0)
    	if (yi <= Float32(-9.999999960041972e-12))
    		tmp = t_0;
    	elseif (yi <= Float32(1.99999996490334e-14))
    		tmp = fma(Float32(maxCos * ux), fma(ux, Float32(-zi), zi), xi);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\
    \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\
    \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, \mathsf{fma}\left(ux, -zi, zi\right), xi\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if yi < -9.99999996e-12 or 1.99999996e-14 < yi

      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. Simplified97.4%

        \[\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 ux\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 \color{blue}{\left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + 2 \cdot \left(\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto xi \cdot \left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \color{blue}{\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}\right) \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 \]
        2. distribute-rgt1-inN/A

          \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
        3. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
        4. accelerator-lowering-fma.f32N/A

          \[\leadsto xi \cdot \left(\color{blue}{\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right)} \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 \]
        5. /-lowering-/.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \color{blue}{\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}}, 1\right) \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 \]
        6. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{\color{blue}{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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 \]
        8. PI-lowering-PI.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{xi}, 1\right) \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 \]
        9. sqrt-lowering-sqrt.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right) \cdot \color{blue}{\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 \]
      8. Simplified82.1%

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

        \[\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)} \]
      10. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \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)}} \]
        2. *-lowering-*.f32N/A

          \[\leadsto \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)}} \]
        3. *-lowering-*.f32N/A

          \[\leadsto \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)} \]
        4. *-lowering-*.f32N/A

          \[\leadsto \left(2 \cdot \color{blue}{\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)} \]
        5. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\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 ux\right), 1\right)}} \]
      12. Taylor expanded in maxCos around 0

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

          \[\leadsto \color{blue}{\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2} \]
        2. associate-*l*N/A

          \[\leadsto \color{blue}{uy \cdot \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right)} \]
        3. *-commutativeN/A

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

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

          \[\leadsto uy \cdot \color{blue}{\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        6. *-commutativeN/A

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

          \[\leadsto uy \cdot \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot yi\right)}\right) \]
        8. PI-lowering-PI.f3261.2

          \[\leadsto uy \cdot \left(2 \cdot \left(\color{blue}{\pi} \cdot yi\right)\right) \]
      14. Simplified61.2%

        \[\leadsto \color{blue}{uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)} \]

      if -9.99999996e-12 < yi < 1.99999996e-14

      1. Initial program 99.0%

        \[\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 maxCos around 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
        13. *-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}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}\right)\right) \]
        14. 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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        15. *-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), maxCos \cdot \color{blue}{\left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)}\right)\right) \]
        16. *-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), maxCos \cdot \left(\color{blue}{\left(ux \cdot zi\right)} \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. Simplified99.0%

        \[\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), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)\right)} \]
      6. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{\left(-1 \cdot ux + 1\right)} \cdot zi, xi\right) \]
        9. distribute-lft1-inN/A

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \mathsf{fma}\left(ux, \color{blue}{\mathsf{neg}\left(zi\right)}, zi\right), xi\right) \]
        16. neg-lowering-neg.f3267.9

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \mathsf{fma}\left(ux, -zi, zi\right), xi\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 16: 59.9% accurate, 12.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\ \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(1, xi, maxCos \cdot \left(ux \cdot zi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* uy (* 2.0 (* PI yi)))))
       (if (<= yi -9.999999960041972e-12)
         t_0
         (if (<= yi 1.99999996490334e-14) (fma 1.0 xi (* maxCos (* ux zi))) 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) * yi));
    	float tmp;
    	if (yi <= -9.999999960041972e-12f) {
    		tmp = t_0;
    	} else if (yi <= 1.99999996490334e-14f) {
    		tmp = fmaf(1.0f, xi, (maxCos * (ux * zi)));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = Float32(uy * Float32(Float32(2.0) * Float32(Float32(pi) * yi)))
    	tmp = Float32(0.0)
    	if (yi <= Float32(-9.999999960041972e-12))
    		tmp = t_0;
    	elseif (yi <= Float32(1.99999996490334e-14))
    		tmp = fma(Float32(1.0), xi, Float32(maxCos * Float32(ux * zi)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\
    \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\
    \;\;\;\;\mathsf{fma}\left(1, xi, maxCos \cdot \left(ux \cdot zi\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if yi < -9.99999996e-12 or 1.99999996e-14 < yi

      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. Simplified97.4%

        \[\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 ux\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 \color{blue}{\left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + 2 \cdot \left(\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      7. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto xi \cdot \left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \color{blue}{\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}\right) \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 \]
        2. distribute-rgt1-inN/A

          \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
        3. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
        4. accelerator-lowering-fma.f32N/A

          \[\leadsto xi \cdot \left(\color{blue}{\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right)} \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 \]
        5. /-lowering-/.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \color{blue}{\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}}, 1\right) \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 \]
        6. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{\color{blue}{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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. *-lowering-*.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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 \]
        8. PI-lowering-PI.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{xi}, 1\right) \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 \]
        9. sqrt-lowering-sqrt.f32N/A

          \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right) \cdot \color{blue}{\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 \]
      8. Simplified82.1%

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

        \[\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)} \]
      10. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \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)}} \]
        2. *-lowering-*.f32N/A

          \[\leadsto \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)}} \]
        3. *-lowering-*.f32N/A

          \[\leadsto \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)} \]
        4. *-lowering-*.f32N/A

          \[\leadsto \left(2 \cdot \color{blue}{\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)} \]
        5. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\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 ux\right), 1\right)}} \]
      12. Taylor expanded in maxCos around 0

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

          \[\leadsto \color{blue}{\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2} \]
        2. associate-*l*N/A

          \[\leadsto \color{blue}{uy \cdot \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right)} \]
        3. *-commutativeN/A

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

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

          \[\leadsto uy \cdot \color{blue}{\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        6. *-commutativeN/A

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

          \[\leadsto uy \cdot \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot yi\right)}\right) \]
        8. PI-lowering-PI.f3261.2

          \[\leadsto uy \cdot \left(2 \cdot \left(\color{blue}{\pi} \cdot yi\right)\right) \]
      14. Simplified61.2%

        \[\leadsto \color{blue}{uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)} \]

      if -9.99999996e-12 < yi < 1.99999996e-14

      1. Initial program 99.0%

        \[\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 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + \left(xi \cdot \cos \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}{\left(xi \cdot \cos \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)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        2. associate-*l*N/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)}\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\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) \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)} \]
      5. Simplified77.8%

        \[\leadsto \color{blue}{\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 ux\right), 1\right)} \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)} \]
      6. Step-by-step derivation
        1. associate-*r*N/A

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

          \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\color{blue}{\left(uy \cdot 2\right)} \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        3. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        12. PI-lowering-PI.f3277.6

          \[\leadsto \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 ux\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\color{blue}{\pi}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
      7. Applied egg-rr77.6%

        \[\leadsto \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 ux\right), 1\right)} \cdot \cos \color{blue}{\left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\pi}\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
      8. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{1}, xi, maxCos \cdot \left(ux \cdot zi\right)\right) \]
      12. Step-by-step derivation
        1. Simplified65.7%

          \[\leadsto \mathsf{fma}\left(\color{blue}{1}, xi, maxCos \cdot \left(ux \cdot zi\right)\right) \]
      13. Recombined 2 regimes into one program.
      14. Add Preprocessing

      Alternative 17: 59.9% accurate, 12.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\ \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(maxCos, ux \cdot zi, xi\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (let* ((t_0 (* uy (* 2.0 (* PI yi)))))
         (if (<= yi -9.999999960041972e-12)
           t_0
           (if (<= yi 1.99999996490334e-14) (fma maxCos (* ux zi) xi) 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) * yi));
      	float tmp;
      	if (yi <= -9.999999960041972e-12f) {
      		tmp = t_0;
      	} else if (yi <= 1.99999996490334e-14f) {
      		tmp = fmaf(maxCos, (ux * zi), xi);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	t_0 = Float32(uy * Float32(Float32(2.0) * Float32(Float32(pi) * yi)))
      	tmp = Float32(0.0)
      	if (yi <= Float32(-9.999999960041972e-12))
      		tmp = t_0;
      	elseif (yi <= Float32(1.99999996490334e-14))
      		tmp = fma(maxCos, Float32(ux * zi), xi);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)\\
      \mathbf{if}\;yi \leq -9.999999960041972 \cdot 10^{-12}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;yi \leq 1.99999996490334 \cdot 10^{-14}:\\
      \;\;\;\;\mathsf{fma}\left(maxCos, ux \cdot zi, xi\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if yi < -9.99999996e-12 or 1.99999996e-14 < yi

        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. Simplified97.4%

          \[\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 ux\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 \color{blue}{\left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + 2 \cdot \left(\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} \cdot \sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)}\right)\right)} + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        7. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto xi \cdot \left(\sqrt{1 + -1 \cdot \left({maxCos}^{2} \cdot \left({ux}^{2} \cdot {\left(1 - ux\right)}^{2}\right)\right)} + \color{blue}{\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}\right) \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 \]
          2. distribute-rgt1-inN/A

            \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
          3. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \color{blue}{\left(\left(2 \cdot \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi} + 1\right) \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 \]
          4. accelerator-lowering-fma.f32N/A

            \[\leadsto xi \cdot \left(\color{blue}{\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right)} \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 \]
          5. /-lowering-/.f32N/A

            \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \color{blue}{\frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}}, 1\right) \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 \]
          6. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{\color{blue}{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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. *-lowering-*.f32N/A

            \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}}{xi}, 1\right) \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 \]
          8. PI-lowering-PI.f32N/A

            \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{xi}, 1\right) \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 \]
          9. sqrt-lowering-sqrt.f32N/A

            \[\leadsto xi \cdot \left(\mathsf{fma}\left(2, \frac{uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)}{xi}, 1\right) \cdot \color{blue}{\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 \]
        8. Simplified82.1%

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

          \[\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)} \]
        10. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \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)}} \]
          2. *-lowering-*.f32N/A

            \[\leadsto \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)}} \]
          3. *-lowering-*.f32N/A

            \[\leadsto \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)} \]
          4. *-lowering-*.f32N/A

            \[\leadsto \left(2 \cdot \color{blue}{\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)} \]
          5. *-commutativeN/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\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 ux\right), 1\right)}} \]
        12. Taylor expanded in maxCos around 0

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

            \[\leadsto \color{blue}{\left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2} \]
          2. associate-*l*N/A

            \[\leadsto \color{blue}{uy \cdot \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right)} \]
          3. *-commutativeN/A

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

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

            \[\leadsto uy \cdot \color{blue}{\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)} \]
          6. *-commutativeN/A

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

            \[\leadsto uy \cdot \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot yi\right)}\right) \]
          8. PI-lowering-PI.f3261.2

            \[\leadsto uy \cdot \left(2 \cdot \left(\color{blue}{\pi} \cdot yi\right)\right) \]
        14. Simplified61.2%

          \[\leadsto \color{blue}{uy \cdot \left(2 \cdot \left(\pi \cdot yi\right)\right)} \]

        if -9.99999996e-12 < yi < 1.99999996e-14

        1. Initial program 99.0%

          \[\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 0

          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + \left(xi \cdot \cos \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}{\left(xi \cdot \cos \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)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
          2. associate-*l*N/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)}\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\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) \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)} \]
        5. Simplified77.8%

          \[\leadsto \color{blue}{\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 ux\right), 1\right)} \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)} \]
        6. Step-by-step derivation
          1. associate-*r*N/A

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

            \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\color{blue}{\left(uy \cdot 2\right)} \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
          3. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
          12. PI-lowering-PI.f3277.6

            \[\leadsto \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 ux\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\color{blue}{\pi}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        7. Applied egg-rr77.6%

          \[\leadsto \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 ux\right), 1\right)} \cdot \cos \color{blue}{\left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\pi}\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        8. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot zi, xi\right)} \]
          3. *-lowering-*.f3265.7

            \[\leadsto \mathsf{fma}\left(maxCos, \color{blue}{ux \cdot zi}, xi\right) \]
        13. Simplified65.7%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot zi, xi\right)} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 18: 49.8% accurate, 29.4× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(maxCos, ux \cdot zi, xi\right) \end{array} \]
      (FPCore (xi yi zi ux uy maxCos) :precision binary32 (fma maxCos (* ux zi) xi))
      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
      	return fmaf(maxCos, (ux * zi), xi);
      }
      
      function code(xi, yi, zi, ux, uy, maxCos)
      	return fma(maxCos, Float32(ux * zi), xi)
      end
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(maxCos, ux \cdot zi, xi\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 0

        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + \left(xi \cdot \cos \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}{\left(xi \cdot \cos \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)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
        2. associate-*l*N/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)}\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\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) \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)} \]
      5. Simplified56.4%

        \[\leadsto \color{blue}{\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 ux\right), 1\right)} \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right)} \]
      6. Step-by-step derivation
        1. associate-*r*N/A

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

          \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\color{blue}{\left(uy \cdot 2\right)} \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        3. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(xi, \sqrt{\mathsf{fma}\left(maxCos \cdot maxCos, \left(\left(1 - ux\right) \cdot \left(1 - ux\right)\right) \cdot \left(\mathsf{neg}\left(ux \cdot ux\right)\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
        12. PI-lowering-PI.f3256.3

          \[\leadsto \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 ux\right), 1\right)} \cdot \cos \left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\color{blue}{\pi}}\right), maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
      7. Applied egg-rr56.3%

        \[\leadsto \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 ux\right), 1\right)} \cdot \cos \color{blue}{\left(\left(\left(2 \cdot uy\right) \cdot \sqrt{\pi}\right) \cdot \sqrt{\pi}\right)}, maxCos \cdot \left(\left(ux \cdot zi\right) \cdot \left(1 - ux\right)\right)\right) \]
      8. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, \color{blue}{maxCos \cdot \left(ux \cdot zi\right)}\right) \]
        9. *-lowering-*.f3255.0

          \[\leadsto \mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right), xi, maxCos \cdot \color{blue}{\left(ux \cdot zi\right)}\right) \]
      10. Simplified55.0%

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot zi, xi\right)} \]
        3. *-lowering-*.f3248.2

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

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

      Alternative 19: 11.7% accurate, 32.1× speedup?

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

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

        \[\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. *-lowering-*.f3212.7

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

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

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

      Alternative 20: 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.7

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

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

      Reproduce

      ?
      herbie shell --seed 2024204 
      (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)))