UniformSampleCone 2

Percentage Accurate: 98.9% → 98.9%
Time: 19.5s
Alternatives: 21
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 98.9% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 3: 98.7% accurate, 1.1× speedup?

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

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

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Step-by-step derivation
    1. associate-+l+99.1%

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

      \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
    3. fma-define99.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
  3. Simplified99.0%

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

    \[\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 \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
  6. Step-by-step derivation
    1. fma-define99.0%

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

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

      \[\leadsto \mathsf{fma}\left(maxCos, ux \cdot \left(\left(1 - ux\right) \cdot zi\right), \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)}\right) \]
  7. Simplified98.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(\left(1 - ux\right) \cdot zi\right), \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)\right)} \]
  8. Final simplification98.9%

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

Alternative 4: 98.7% 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, yi \cdot \sin t\_0\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\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) (* yi (sin t_0)))
    (* (* maxCos zi) (* ux (- 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), (yi * sinf(t_0))) + ((maxCos * zi) * (ux * (1.0f - ux)));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	return Float32(fma(xi, cos(t_0), Float32(yi * sin(t_0))) + Float32(Float32(maxCos * zi) * Float32(ux * 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, yi \cdot \sin t\_0\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 99.1%

    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  2. Step-by-step derivation
    1. Simplified99.0%

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

      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
    4. Step-by-step derivation
      1. fma-define98.9%

        \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
    5. Simplified98.9%

      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
    6. Step-by-step derivation
      1. pow198.9%

        \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
      2. associate-*r*98.9%

        \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
      3. *-commutative98.9%

        \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
      4. associate-*r*98.9%

        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
      5. *-commutative98.9%

        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
      6. associate-*r*98.9%

        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
    7. Applied egg-rr98.9%

      \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
    8. Step-by-step derivation
      1. unpow198.9%

        \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
      2. associate-*r*98.9%

        \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
      3. *-commutative98.9%

        \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
    9. Simplified98.9%

      \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
    10. Add Preprocessing

    Alternative 5: 98.7% accurate, 2.0× speedup?

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

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Step-by-step derivation
      1. associate-+l+99.1%

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

        \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
      3. fma-define99.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
    3. Simplified99.0%

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

      \[\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 \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
    6. Final simplification98.9%

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

    Alternative 6: 96.0% accurate, 2.1× speedup?

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

      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
    2. Step-by-step derivation
      1. associate-+l+99.1%

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

        \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
      3. fma-define99.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
    3. Simplified99.0%

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

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

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

    Alternative 7: 96.2% accurate, 2.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathbf{if}\;uy \leq 0.001458600047044456:\\ \;\;\;\;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 {\pi}^{2}\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \sin t\_0 + xi \cdot \cos t\_0\\ \end{array} \end{array} \]
    (FPCore (xi yi zi ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* 2.0 (* uy PI))))
       (if (<= uy 0.001458600047044456)
         (+
          xi
          (+
           (* maxCos (* ux (* zi (- 1.0 ux))))
           (* uy (+ (* -2.0 (* uy (* xi (pow PI 2.0)))) (* 2.0 (* PI yi))))))
         (+ (* yi (sin t_0)) (* xi (cos t_0))))))
    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
    	float t_0 = 2.0f * (uy * ((float) M_PI));
    	float tmp;
    	if (uy <= 0.001458600047044456f) {
    		tmp = xi + ((maxCos * (ux * (zi * (1.0f - ux)))) + (uy * ((-2.0f * (uy * (xi * powf(((float) M_PI), 2.0f)))) + (2.0f * (((float) M_PI) * yi)))));
    	} else {
    		tmp = (yi * sinf(t_0)) + (xi * cosf(t_0));
    	}
    	return tmp;
    }
    
    function code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
    	tmp = Float32(0.0)
    	if (uy <= Float32(0.001458600047044456))
    		tmp = Float32(xi + Float32(Float32(maxCos * Float32(ux * Float32(zi * Float32(Float32(1.0) - ux)))) + Float32(uy * Float32(Float32(Float32(-2.0) * Float32(uy * Float32(xi * (Float32(pi) ^ Float32(2.0))))) + Float32(Float32(2.0) * Float32(Float32(pi) * yi))))));
    	else
    		tmp = Float32(Float32(yi * sin(t_0)) + Float32(xi * cos(t_0)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
    	t_0 = single(2.0) * (uy * single(pi));
    	tmp = single(0.0);
    	if (uy <= single(0.001458600047044456))
    		tmp = xi + ((maxCos * (ux * (zi * (single(1.0) - ux)))) + (uy * ((single(-2.0) * (uy * (xi * (single(pi) ^ single(2.0))))) + (single(2.0) * (single(pi) * yi)))));
    	else
    		tmp = (yi * sin(t_0)) + (xi * cos(t_0));
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
    \mathbf{if}\;uy \leq 0.001458600047044456:\\
    \;\;\;\;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 {\pi}^{2}\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;yi \cdot \sin t\_0 + xi \cdot \cos t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if uy < 0.00145860005

      1. Initial program 99.4%

        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
      2. Step-by-step derivation
        1. Simplified99.4%

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

          \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
        4. Step-by-step derivation
          1. fma-define99.3%

            \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
        5. Simplified99.3%

          \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
        6. Step-by-step derivation
          1. add-cube-cbrt99.0%

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

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

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

          \[\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 {\pi}^{2}\right)\right) + 2 \cdot \left(yi \cdot \pi\right)\right)\right)} \]

        if 0.00145860005 < uy

        1. Initial program 98.2%

          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
        2. Step-by-step derivation
          1. Simplified98.2%

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

            \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
          4. Step-by-step derivation
            1. fma-define97.8%

              \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
          5. Simplified97.8%

            \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
          6. Step-by-step derivation
            1. add-cube-cbrt97.4%

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 0.001458600047044456:\\ \;\;\;\;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 {\pi}^{2}\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 8: 84.2% accurate, 3.7× speedup?

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

          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. Step-by-step derivation
            1. Simplified99.3%

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

              \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
            4. Step-by-step derivation
              1. fma-define99.1%

                \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
            5. Simplified99.1%

              \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
            6. Step-by-step derivation
              1. add-cube-cbrt98.8%

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

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

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

              \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
            9. Step-by-step derivation
              1. +-commutative91.4%

                \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right) + xi\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              2. *-commutative91.4%

                \[\leadsto \left(2 \cdot \left(uy \cdot \color{blue}{\left(\pi \cdot yi\right)}\right) + xi\right) + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              3. fma-define91.4%

                \[\leadsto \color{blue}{\mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              4. associate-*r*91.5%

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

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

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

            if 0.0500000007 < uy

            1. Initial program 98.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. Step-by-step derivation
              1. Simplified97.7%

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

                \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              4. Step-by-step derivation
                1. fma-define97.7%

                  \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              5. Simplified97.7%

                \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
              6. Step-by-step derivation
                1. add-cube-cbrt97.4%

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

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

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

                \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \left(\frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)\right)} \]
              9. Step-by-step derivation
                1. associate-+r+98.0%

                  \[\leadsto yi \cdot \color{blue}{\left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)} \]
                2. associate-/l*97.9%

                  \[\leadsto yi \cdot \left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \color{blue}{maxCos \cdot \frac{ux \cdot \left(zi \cdot \left(1 - ux\right)\right)}{yi}}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right) \]
                3. *-commutative97.9%

                  \[\leadsto yi \cdot \left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \frac{ux \cdot \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)}}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right) \]
                4. associate-/l*97.6%

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

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

                \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi}\right)} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification87.6%

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

            Alternative 9: 84.2% accurate, 3.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{fma}\left(2, yi \cdot \left(uy \cdot \pi\right), xi\right) + zi \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot maxCos\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\\ \end{array} \end{array} \]
            (FPCore (xi yi zi ux uy maxCos)
             :precision binary32
             (if (<= uy 0.05000000074505806)
               (+ (fma 2.0 (* yi (* uy PI)) xi) (* zi (* (- 1.0 ux) (* ux maxCos))))
               (+ (* 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 (uy <= 0.05000000074505806f) {
            		tmp = fmaf(2.0f, (yi * (uy * ((float) M_PI))), xi) + (zi * ((1.0f - ux) * (ux * maxCos)));
            	} else {
            		tmp = (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 (uy <= Float32(0.05000000074505806))
            		tmp = Float32(fma(Float32(2.0), Float32(yi * Float32(uy * Float32(pi))), xi) + Float32(zi * Float32(Float32(Float32(1.0) - ux) * Float32(ux * maxCos))));
            	else
            		tmp = Float32(Float32(yi * sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))) + Float32(maxCos * Float32(ux * Float32(zi * Float32(Float32(1.0) - ux)))));
            	end
            	return tmp
            end
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;uy \leq 0.05000000074505806:\\
            \;\;\;\;\mathsf{fma}\left(2, yi \cdot \left(uy \cdot \pi\right), xi\right) + zi \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot maxCos\right)\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if uy < 0.0500000007

              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. Step-by-step derivation
                1. Simplified99.3%

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

                  \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                4. Step-by-step derivation
                  1. fma-define99.1%

                    \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                5. Simplified99.1%

                  \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                6. Step-by-step derivation
                  1. add-cube-cbrt98.8%

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

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

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

                  \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                9. Step-by-step derivation
                  1. +-commutative91.4%

                    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right) + xi\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  2. *-commutative91.4%

                    \[\leadsto \left(2 \cdot \left(uy \cdot \color{blue}{\left(\pi \cdot yi\right)}\right) + xi\right) + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  3. fma-define91.4%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(2, uy \cdot \left(\pi \cdot yi\right), xi\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  4. associate-*r*91.5%

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

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

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

                if 0.0500000007 < uy

                1. Initial program 98.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. Step-by-step derivation
                  1. Simplified97.7%

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

                    \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  4. Step-by-step derivation
                    1. fma-define97.7%

                      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  5. Simplified97.7%

                    \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                  6. Step-by-step derivation
                    1. add-cube-cbrt97.4%

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

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

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

                    \[\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 \pi\right)\right)} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification87.6%

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

                Alternative 10: 84.2% accurate, 3.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.05000000074505806:\\ \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\\ \end{array} \end{array} \]
                (FPCore (xi yi zi ux uy maxCos)
                 :precision binary32
                 (if (<= uy 0.05000000074505806)
                   (+ (* (* maxCos zi) (* ux (- 1.0 ux))) (+ xi (* (* PI yi) (* uy 2.0))))
                   (+ (* 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 (uy <= 0.05000000074505806f) {
                		tmp = ((maxCos * zi) * (ux * (1.0f - ux))) + (xi + ((((float) M_PI) * yi) * (uy * 2.0f)));
                	} else {
                		tmp = (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 (uy <= Float32(0.05000000074505806))
                		tmp = Float32(Float32(Float32(maxCos * zi) * Float32(ux * Float32(Float32(1.0) - ux))) + Float32(xi + Float32(Float32(Float32(pi) * yi) * Float32(uy * Float32(2.0)))));
                	else
                		tmp = Float32(Float32(yi * sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))) + Float32(maxCos * Float32(ux * Float32(zi * Float32(Float32(1.0) - ux)))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
                	tmp = single(0.0);
                	if (uy <= single(0.05000000074505806))
                		tmp = ((maxCos * zi) * (ux * (single(1.0) - ux))) + (xi + ((single(pi) * yi) * (uy * single(2.0))));
                	else
                		tmp = (yi * sin((single(2.0) * (uy * single(pi))))) + (maxCos * (ux * (zi * (single(1.0) - ux))));
                	end
                	tmp_2 = tmp;
                end
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;uy \leq 0.05000000074505806:\\
                \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if uy < 0.0500000007

                  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. Step-by-step derivation
                    1. Simplified99.3%

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

                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                    4. Step-by-step derivation
                      1. fma-define99.1%

                        \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                    5. Simplified99.1%

                      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                    6. Step-by-step derivation
                      1. pow199.1%

                        \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                      2. associate-*r*99.1%

                        \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                      3. *-commutative99.1%

                        \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                      4. associate-*r*99.1%

                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                      5. *-commutative99.1%

                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                      6. associate-*r*99.1%

                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                    7. Applied egg-rr99.1%

                      \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                    8. Step-by-step derivation
                      1. unpow199.1%

                        \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                      2. associate-*r*99.1%

                        \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                      3. *-commutative99.1%

                        \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                    9. Simplified99.1%

                      \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                    10. Taylor expanded in uy around 0 91.5%

                      \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                    11. Step-by-step derivation
                      1. associate-*r*91.5%

                        \[\leadsto \left(xi + \color{blue}{\left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)}\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                    12. Simplified91.5%

                      \[\leadsto \color{blue}{\left(xi + \left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]

                    if 0.0500000007 < uy

                    1. Initial program 98.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. Step-by-step derivation
                      1. Simplified97.7%

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

                        \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                      4. Step-by-step derivation
                        1. fma-define97.7%

                          \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                      5. Simplified97.7%

                        \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                      6. Step-by-step derivation
                        1. add-cube-cbrt97.4%

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

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

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

                        \[\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 \pi\right)\right)} \]
                    3. Recombined 2 regimes into one program.
                    4. Final simplification87.5%

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

                    Alternative 11: 88.1% accurate, 3.9× speedup?

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

                      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                    2. Step-by-step derivation
                      1. associate-+l+99.1%

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

                        \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
                      3. fma-define99.0%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
                    3. Simplified99.0%

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

                      \[\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 \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} \]
                    6. Taylor expanded in uy around 0 90.3%

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

                    Alternative 12: 84.0% accurate, 3.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.05000000074505806:\\ \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + ux \cdot \left(maxCos \cdot zi\right)\\ \end{array} \end{array} \]
                    (FPCore (xi yi zi ux uy maxCos)
                     :precision binary32
                     (if (<= uy 0.05000000074505806)
                       (+ (* (* maxCos zi) (* ux (- 1.0 ux))) (+ xi (* (* PI yi) (* uy 2.0))))
                       (+ (* yi (sin (* 2.0 (* uy PI)))) (* ux (* maxCos zi)))))
                    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                    	float tmp;
                    	if (uy <= 0.05000000074505806f) {
                    		tmp = ((maxCos * zi) * (ux * (1.0f - ux))) + (xi + ((((float) M_PI) * yi) * (uy * 2.0f)));
                    	} else {
                    		tmp = (yi * sinf((2.0f * (uy * ((float) M_PI))))) + (ux * (maxCos * zi));
                    	}
                    	return tmp;
                    }
                    
                    function code(xi, yi, zi, ux, uy, maxCos)
                    	tmp = Float32(0.0)
                    	if (uy <= Float32(0.05000000074505806))
                    		tmp = Float32(Float32(Float32(maxCos * zi) * Float32(ux * Float32(Float32(1.0) - ux))) + Float32(xi + Float32(Float32(Float32(pi) * yi) * Float32(uy * Float32(2.0)))));
                    	else
                    		tmp = Float32(Float32(yi * sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))) + Float32(ux * Float32(maxCos * zi)));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
                    	tmp = single(0.0);
                    	if (uy <= single(0.05000000074505806))
                    		tmp = ((maxCos * zi) * (ux * (single(1.0) - ux))) + (xi + ((single(pi) * yi) * (uy * single(2.0))));
                    	else
                    		tmp = (yi * sin((single(2.0) * (uy * single(pi))))) + (ux * (maxCos * zi));
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;uy \leq 0.05000000074505806:\\
                    \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + ux \cdot \left(maxCos \cdot zi\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if uy < 0.0500000007

                      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. Step-by-step derivation
                        1. Simplified99.3%

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

                          \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                        4. Step-by-step derivation
                          1. fma-define99.1%

                            \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                        5. Simplified99.1%

                          \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                        6. Step-by-step derivation
                          1. pow199.1%

                            \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                          2. associate-*r*99.1%

                            \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                          3. *-commutative99.1%

                            \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                          4. associate-*r*99.1%

                            \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                          5. *-commutative99.1%

                            \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                          6. associate-*r*99.1%

                            \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                        7. Applied egg-rr99.1%

                          \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                        8. Step-by-step derivation
                          1. unpow199.1%

                            \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                          2. associate-*r*99.1%

                            \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                          3. *-commutative99.1%

                            \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                        9. Simplified99.1%

                          \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                        10. Taylor expanded in uy around 0 91.5%

                          \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                        11. Step-by-step derivation
                          1. associate-*r*91.5%

                            \[\leadsto \left(xi + \color{blue}{\left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)}\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                        12. Simplified91.5%

                          \[\leadsto \color{blue}{\left(xi + \left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]

                        if 0.0500000007 < uy

                        1. Initial program 98.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. Step-by-step derivation
                          1. Simplified97.7%

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

                            \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                          4. Step-by-step derivation
                            1. fma-define97.7%

                              \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                          5. Simplified97.7%

                            \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                          6. Step-by-step derivation
                            1. pow197.7%

                              \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                            2. associate-*r*97.8%

                              \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                            3. *-commutative97.8%

                              \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                            4. associate-*r*97.7%

                              \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                            5. *-commutative97.7%

                              \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                            6. associate-*r*97.7%

                              \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                          7. Applied egg-rr97.7%

                            \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                          8. Step-by-step derivation
                            1. unpow197.7%

                              \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                            2. associate-*r*97.7%

                              \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                            3. *-commutative97.7%

                              \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                          9. Simplified97.7%

                            \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                          10. Taylor expanded in xi around 0 65.5%

                            \[\leadsto \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                          11. Taylor expanded in ux around 0 63.8%

                            \[\leadsto yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \left(maxCos \cdot zi\right) \cdot \color{blue}{ux} \]
                        3. Recombined 2 regimes into one program.
                        4. Final simplification87.2%

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

                        Alternative 13: 83.5% accurate, 4.1× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.05000000074505806:\\ \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\\ \end{array} \end{array} \]
                        (FPCore (xi yi zi ux uy maxCos)
                         :precision binary32
                         (if (<= uy 0.05000000074505806)
                           (+ (* (* maxCos zi) (* ux (- 1.0 ux))) (+ xi (* (* PI yi) (* uy 2.0))))
                           (* (sin (* uy (* 2.0 PI))) yi)))
                        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                        	float tmp;
                        	if (uy <= 0.05000000074505806f) {
                        		tmp = ((maxCos * zi) * (ux * (1.0f - ux))) + (xi + ((((float) M_PI) * yi) * (uy * 2.0f)));
                        	} else {
                        		tmp = sinf((uy * (2.0f * ((float) M_PI)))) * yi;
                        	}
                        	return tmp;
                        }
                        
                        function code(xi, yi, zi, ux, uy, maxCos)
                        	tmp = Float32(0.0)
                        	if (uy <= Float32(0.05000000074505806))
                        		tmp = Float32(Float32(Float32(maxCos * zi) * Float32(ux * Float32(Float32(1.0) - ux))) + Float32(xi + Float32(Float32(Float32(pi) * yi) * Float32(uy * Float32(2.0)))));
                        	else
                        		tmp = Float32(sin(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * yi);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
                        	tmp = single(0.0);
                        	if (uy <= single(0.05000000074505806))
                        		tmp = ((maxCos * zi) * (ux * (single(1.0) - ux))) + (xi + ((single(pi) * yi) * (uy * single(2.0))));
                        	else
                        		tmp = sin((uy * (single(2.0) * single(pi)))) * yi;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;uy \leq 0.05000000074505806:\\
                        \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if uy < 0.0500000007

                          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. Step-by-step derivation
                            1. Simplified99.3%

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

                              \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                            4. Step-by-step derivation
                              1. fma-define99.1%

                                \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                            5. Simplified99.1%

                              \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                            6. Step-by-step derivation
                              1. pow199.1%

                                \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                              2. associate-*r*99.1%

                                \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                              3. *-commutative99.1%

                                \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                              4. associate-*r*99.1%

                                \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                              5. *-commutative99.1%

                                \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                              6. associate-*r*99.1%

                                \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                            7. Applied egg-rr99.1%

                              \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                            8. Step-by-step derivation
                              1. unpow199.1%

                                \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                              2. associate-*r*99.1%

                                \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                              3. *-commutative99.1%

                                \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                            9. Simplified99.1%

                              \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                            10. Taylor expanded in uy around 0 91.5%

                              \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                            11. Step-by-step derivation
                              1. associate-*r*91.5%

                                \[\leadsto \left(xi + \color{blue}{\left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)}\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                            12. Simplified91.5%

                              \[\leadsto \color{blue}{\left(xi + \left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]

                            if 0.0500000007 < uy

                            1. Initial program 98.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. Step-by-step derivation
                              1. Simplified97.7%

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

                                \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                              4. Step-by-step derivation
                                1. fma-define97.7%

                                  \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                              5. Simplified97.7%

                                \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                              6. Step-by-step derivation
                                1. add-cube-cbrt97.4%

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

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

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

                                \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \left(\frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)\right)} \]
                              9. Step-by-step derivation
                                1. associate-+r+98.0%

                                  \[\leadsto yi \cdot \color{blue}{\left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)} \]
                                2. associate-/l*97.9%

                                  \[\leadsto yi \cdot \left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \color{blue}{maxCos \cdot \frac{ux \cdot \left(zi \cdot \left(1 - ux\right)\right)}{yi}}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right) \]
                                3. *-commutative97.9%

                                  \[\leadsto yi \cdot \left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \frac{ux \cdot \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)}}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right) \]
                                4. associate-/l*97.6%

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

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

                                \[\leadsto \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} \]
                              12. Step-by-step derivation
                                1. *-commutative62.2%

                                  \[\leadsto yi \cdot \sin \color{blue}{\left(\left(uy \cdot \pi\right) \cdot 2\right)} \]
                                2. associate-*r*62.2%

                                  \[\leadsto yi \cdot \sin \color{blue}{\left(uy \cdot \left(\pi \cdot 2\right)\right)} \]
                                3. *-commutative62.2%

                                  \[\leadsto yi \cdot \sin \left(uy \cdot \color{blue}{\left(2 \cdot \pi\right)}\right) \]
                              13. Simplified62.2%

                                \[\leadsto \color{blue}{yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
                            3. Recombined 2 regimes into one program.
                            4. Final simplification87.0%

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

                            Alternative 14: 61.8% accurate, 17.0× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)\\ \mathbf{if}\;yi \leq -3.99999992980668 \cdot 10^{-13} \lor \neg \left(yi \leq 5.999999802552836 \cdot 10^{-11}\right):\\ \;\;\;\;t\_0 + \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\\ \mathbf{else}:\\ \;\;\;\;xi + t\_0\\ \end{array} \end{array} \]
                            (FPCore (xi yi zi ux uy maxCos)
                             :precision binary32
                             (let* ((t_0 (* (* maxCos zi) (* ux (- 1.0 ux)))))
                               (if (or (<= yi -3.99999992980668e-13) (not (<= yi 5.999999802552836e-11)))
                                 (+ t_0 (* (* uy (* 2.0 PI)) yi))
                                 (+ xi t_0))))
                            float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                            	float t_0 = (maxCos * zi) * (ux * (1.0f - ux));
                            	float tmp;
                            	if ((yi <= -3.99999992980668e-13f) || !(yi <= 5.999999802552836e-11f)) {
                            		tmp = t_0 + ((uy * (2.0f * ((float) M_PI))) * yi);
                            	} else {
                            		tmp = xi + t_0;
                            	}
                            	return tmp;
                            }
                            
                            function code(xi, yi, zi, ux, uy, maxCos)
                            	t_0 = Float32(Float32(maxCos * zi) * Float32(ux * Float32(Float32(1.0) - ux)))
                            	tmp = Float32(0.0)
                            	if ((yi <= Float32(-3.99999992980668e-13)) || !(yi <= Float32(5.999999802552836e-11)))
                            		tmp = Float32(t_0 + Float32(Float32(uy * Float32(Float32(2.0) * Float32(pi))) * yi));
                            	else
                            		tmp = Float32(xi + t_0);
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
                            	t_0 = (maxCos * zi) * (ux * (single(1.0) - ux));
                            	tmp = single(0.0);
                            	if ((yi <= single(-3.99999992980668e-13)) || ~((yi <= single(5.999999802552836e-11))))
                            		tmp = t_0 + ((uy * (single(2.0) * single(pi))) * yi);
                            	else
                            		tmp = xi + t_0;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)\\
                            \mathbf{if}\;yi \leq -3.99999992980668 \cdot 10^{-13} \lor \neg \left(yi \leq 5.999999802552836 \cdot 10^{-11}\right):\\
                            \;\;\;\;t\_0 + \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;xi + t\_0\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if yi < -3.99999993e-13 or 5.9999998e-11 < yi

                              1. Initial program 98.8%

                                \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                              2. Step-by-step derivation
                                1. Simplified98.8%

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

                                  \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                4. Step-by-step derivation
                                  1. fma-define98.6%

                                    \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                5. Simplified98.6%

                                  \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                6. Step-by-step derivation
                                  1. pow198.6%

                                    \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                                  2. associate-*r*98.6%

                                    \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                                  3. *-commutative98.6%

                                    \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                                  4. associate-*r*98.6%

                                    \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                                  5. *-commutative98.6%

                                    \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                                  6. associate-*r*98.6%

                                    \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                                7. Applied egg-rr98.6%

                                  \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                                8. Step-by-step derivation
                                  1. unpow198.6%

                                    \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                                  2. associate-*r*98.6%

                                    \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                  3. *-commutative98.6%

                                    \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                9. Simplified98.6%

                                  \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                10. Taylor expanded in xi around 0 72.7%

                                  \[\leadsto \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                11. Taylor expanded in uy around 0 59.9%

                                  \[\leadsto yi \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                12. Step-by-step derivation
                                  1. *-commutative59.9%

                                    \[\leadsto yi \cdot \color{blue}{\left(\left(uy \cdot \pi\right) \cdot 2\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  2. associate-*r*59.9%

                                    \[\leadsto yi \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot 2\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  3. *-commutative59.9%

                                    \[\leadsto yi \cdot \left(uy \cdot \color{blue}{\left(2 \cdot \pi\right)}\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                13. Simplified59.9%

                                  \[\leadsto yi \cdot \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]

                                if -3.99999993e-13 < yi < 5.9999998e-11

                                1. Initial program 99.2%

                                  \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                2. Step-by-step derivation
                                  1. Simplified99.2%

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

                                    \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  4. Step-by-step derivation
                                    1. fma-define99.0%

                                      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  5. Simplified99.0%

                                    \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  6. Step-by-step derivation
                                    1. pow199.0%

                                      \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                                    2. associate-*r*99.0%

                                      \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                                    3. *-commutative99.0%

                                      \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                                    4. associate-*r*99.0%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                                    5. *-commutative99.0%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                                    6. associate-*r*99.0%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                                  7. Applied egg-rr99.0%

                                    \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                                  8. Step-by-step derivation
                                    1. unpow199.0%

                                      \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                                    2. associate-*r*99.0%

                                      \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                    3. *-commutative99.0%

                                      \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  9. Simplified99.0%

                                    \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                  10. Taylor expanded in uy around 0 68.0%

                                    \[\leadsto \color{blue}{xi} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                3. Recombined 2 regimes into one program.
                                4. Final simplification65.4%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;yi \leq -3.99999992980668 \cdot 10^{-13} \lor \neg \left(yi \leq 5.999999802552836 \cdot 10^{-11}\right):\\ \;\;\;\;\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot yi\\ \mathbf{else}:\\ \;\;\;\;xi + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)\\ \end{array} \]
                                5. Add Preprocessing

                                Alternative 15: 81.3% accurate, 24.3× speedup?

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

                                  \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                2. Step-by-step derivation
                                  1. Simplified99.0%

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

                                    \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  4. Step-by-step derivation
                                    1. fma-define98.9%

                                      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  5. Simplified98.9%

                                    \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                  6. Step-by-step derivation
                                    1. pow198.9%

                                      \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                                    2. associate-*r*98.9%

                                      \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                                    3. *-commutative98.9%

                                      \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                                    4. associate-*r*98.9%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                                    5. *-commutative98.9%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                                    6. associate-*r*98.9%

                                      \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                                  7. Applied egg-rr98.9%

                                    \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                                  8. Step-by-step derivation
                                    1. unpow198.9%

                                      \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                                    2. associate-*r*98.9%

                                      \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                    3. *-commutative98.9%

                                      \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  9. Simplified98.9%

                                    \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                  10. Taylor expanded in uy around 0 82.5%

                                    \[\leadsto \color{blue}{\left(xi + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  11. Step-by-step derivation
                                    1. associate-*r*82.5%

                                      \[\leadsto \left(xi + \color{blue}{\left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)}\right) + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  12. Simplified82.5%

                                    \[\leadsto \color{blue}{\left(xi + \left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)\right)} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                  13. Final simplification82.5%

                                    \[\leadsto \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) + \left(xi + \left(\pi \cdot yi\right) \cdot \left(uy \cdot 2\right)\right) \]
                                  14. Add Preprocessing

                                  Alternative 16: 50.9% accurate, 41.9× speedup?

                                  \[\begin{array}{l} \\ xi + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \end{array} \]
                                  (FPCore (xi yi zi ux uy maxCos)
                                   :precision binary32
                                   (+ xi (* (* maxCos zi) (* ux (- 1.0 ux)))))
                                  float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                  	return xi + ((maxCos * zi) * (ux * (1.0f - ux)));
                                  }
                                  
                                  real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                      real(4), intent (in) :: xi
                                      real(4), intent (in) :: yi
                                      real(4), intent (in) :: zi
                                      real(4), intent (in) :: ux
                                      real(4), intent (in) :: uy
                                      real(4), intent (in) :: maxcos
                                      code = xi + ((maxcos * zi) * (ux * (1.0e0 - ux)))
                                  end function
                                  
                                  function code(xi, yi, zi, ux, uy, maxCos)
                                  	return Float32(xi + Float32(Float32(maxCos * zi) * Float32(ux * Float32(Float32(1.0) - ux))))
                                  end
                                  
                                  function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                  	tmp = xi + ((maxCos * zi) * (ux * (single(1.0) - ux)));
                                  end
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  xi + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 99.1%

                                    \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                  2. Step-by-step derivation
                                    1. Simplified99.0%

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

                                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                    4. Step-by-step derivation
                                      1. fma-define98.9%

                                        \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                    5. Simplified98.9%

                                      \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                    6. Step-by-step derivation
                                      1. pow198.9%

                                        \[\leadsto \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) + \color{blue}{{\left(\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi\right)}^{1}} \]
                                      2. associate-*r*98.9%

                                        \[\leadsto \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) + {\left(\color{blue}{\left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)} \cdot zi\right)}^{1} \]
                                      3. *-commutative98.9%

                                        \[\leadsto \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) + {\color{blue}{\left(zi \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)\right)}}^{1} \]
                                      4. associate-*r*98.9%

                                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right)}\right)}^{1} \]
                                      5. *-commutative98.9%

                                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(1 - ux\right)\right)}\right)}^{1} \]
                                      6. associate-*r*98.9%

                                        \[\leadsto \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) + {\left(zi \cdot \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)}\right)}^{1} \]
                                    7. Applied egg-rr98.9%

                                      \[\leadsto \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) + \color{blue}{{\left(zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right)}^{1}} \]
                                    8. Step-by-step derivation
                                      1. unpow198.9%

                                        \[\leadsto \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) + \color{blue}{zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \]
                                      2. associate-*r*98.9%

                                        \[\leadsto \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) + \color{blue}{\left(zi \cdot maxCos\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                      3. *-commutative98.9%

                                        \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right)} \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                    9. Simplified98.9%

                                      \[\leadsto \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) + \color{blue}{\left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right)} \]
                                    10. Taylor expanded in uy around 0 54.2%

                                      \[\leadsto \color{blue}{xi} + \left(maxCos \cdot zi\right) \cdot \left(ux \cdot \left(1 - ux\right)\right) \]
                                    11. Add Preprocessing

                                    Alternative 17: 50.9% accurate, 41.9× speedup?

                                    \[\begin{array}{l} \\ xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \end{array} \]
                                    (FPCore (xi yi zi ux uy maxCos)
                                     :precision binary32
                                     (+ xi (* maxCos (* ux (* zi (- 1.0 ux))))))
                                    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                    	return xi + (maxCos * (ux * (zi * (1.0f - ux))));
                                    }
                                    
                                    real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                        real(4), intent (in) :: xi
                                        real(4), intent (in) :: yi
                                        real(4), intent (in) :: zi
                                        real(4), intent (in) :: ux
                                        real(4), intent (in) :: uy
                                        real(4), intent (in) :: maxcos
                                        code = xi + (maxcos * (ux * (zi * (1.0e0 - ux))))
                                    end function
                                    
                                    function code(xi, yi, zi, ux, uy, maxCos)
                                    	return Float32(xi + Float32(maxCos * Float32(ux * Float32(zi * Float32(Float32(1.0) - ux)))))
                                    end
                                    
                                    function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                    	tmp = xi + (maxCos * (ux * (zi * (single(1.0) - ux))));
                                    end
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 99.1%

                                      \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                    2. Step-by-step derivation
                                      1. Simplified99.0%

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

                                        \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                      4. Step-by-step derivation
                                        1. fma-define98.9%

                                          \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                      5. Simplified98.9%

                                        \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                      6. Step-by-step derivation
                                        1. add-cube-cbrt98.5%

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

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

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

                                        \[\leadsto \color{blue}{xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
                                      9. Step-by-step derivation
                                        1. *-commutative54.2%

                                          \[\leadsto xi + maxCos \cdot \left(ux \cdot \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)}\right) \]
                                      10. Simplified54.2%

                                        \[\leadsto \color{blue}{xi + maxCos \cdot \left(ux \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)} \]
                                      11. Final simplification54.2%

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

                                      Alternative 18: 13.2% accurate, 51.2× speedup?

                                      \[\begin{array}{l} \\ zi \cdot \left(ux \cdot \left(maxCos \cdot \left(1 - ux\right)\right)\right) \end{array} \]
                                      (FPCore (xi yi zi ux uy maxCos)
                                       :precision binary32
                                       (* zi (* ux (* maxCos (- 1.0 ux)))))
                                      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                      	return zi * (ux * (maxCos * (1.0f - ux)));
                                      }
                                      
                                      real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                          real(4), intent (in) :: xi
                                          real(4), intent (in) :: yi
                                          real(4), intent (in) :: zi
                                          real(4), intent (in) :: ux
                                          real(4), intent (in) :: uy
                                          real(4), intent (in) :: maxcos
                                          code = zi * (ux * (maxcos * (1.0e0 - ux)))
                                      end function
                                      
                                      function code(xi, yi, zi, ux, uy, maxCos)
                                      	return Float32(zi * Float32(ux * Float32(maxCos * Float32(Float32(1.0) - ux))))
                                      end
                                      
                                      function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                      	tmp = zi * (ux * (maxCos * (single(1.0) - ux)));
                                      end
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      zi \cdot \left(ux \cdot \left(maxCos \cdot \left(1 - ux\right)\right)\right)
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 99.1%

                                        \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                      2. Step-by-step derivation
                                        1. Simplified99.0%

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

                                          \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                        4. Step-by-step derivation
                                          1. fma-define98.9%

                                            \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                        5. Simplified98.9%

                                          \[\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)} + \left(\left(1 - ux\right) \cdot \left(maxCos \cdot ux\right)\right) \cdot zi \]
                                        6. Step-by-step derivation
                                          1. add-cube-cbrt98.5%

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

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

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

                                          \[\leadsto \color{blue}{yi \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \left(\frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi} + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)\right)} \]
                                        9. Step-by-step derivation
                                          1. associate-+r+98.3%

                                            \[\leadsto yi \cdot \color{blue}{\left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \frac{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right)} \]
                                          2. associate-/l*97.8%

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

                                            \[\leadsto yi \cdot \left(\left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + maxCos \cdot \frac{ux \cdot \color{blue}{\left(\left(1 - ux\right) \cdot zi\right)}}{yi}\right) + \frac{xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)}{yi}\right) \]
                                          4. associate-/l*97.6%

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

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

                                          \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
                                        12. Step-by-step derivation
                                          1. *-commutative14.5%

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

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

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

                                            \[\leadsto \color{blue}{\left(zi \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)} \cdot maxCos \]
                                          5. associate-*r*14.5%

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

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

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

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

                                        Alternative 19: 13.2% accurate, 51.2× speedup?

                                        \[\begin{array}{l} \\ maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \end{array} \]
                                        (FPCore (xi yi zi ux uy maxCos)
                                         :precision binary32
                                         (* maxCos (* ux (* zi (- 1.0 ux)))))
                                        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                        	return maxCos * (ux * (zi * (1.0f - ux)));
                                        }
                                        
                                        real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                            real(4), intent (in) :: xi
                                            real(4), intent (in) :: yi
                                            real(4), intent (in) :: zi
                                            real(4), intent (in) :: ux
                                            real(4), intent (in) :: uy
                                            real(4), intent (in) :: maxcos
                                            code = maxcos * (ux * (zi * (1.0e0 - ux)))
                                        end function
                                        
                                        function code(xi, yi, zi, ux, uy, maxCos)
                                        	return Float32(maxCos * Float32(ux * Float32(zi * Float32(Float32(1.0) - ux))))
                                        end
                                        
                                        function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                        	tmp = maxCos * (ux * (zi * (single(1.0) - ux)));
                                        end
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 99.1%

                                          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                        2. Step-by-step derivation
                                          1. associate-+l+99.1%

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

                                            \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
                                          3. fma-define99.0%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
                                        3. Simplified99.0%

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

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

                                        Alternative 20: 11.7% accurate, 92.2× speedup?

                                        \[\begin{array}{l} \\ ux \cdot \left(maxCos \cdot zi\right) \end{array} \]
                                        (FPCore (xi yi zi ux uy maxCos) :precision binary32 (* ux (* maxCos zi)))
                                        float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                        	return ux * (maxCos * zi);
                                        }
                                        
                                        real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                            real(4), intent (in) :: xi
                                            real(4), intent (in) :: yi
                                            real(4), intent (in) :: zi
                                            real(4), intent (in) :: ux
                                            real(4), intent (in) :: uy
                                            real(4), intent (in) :: maxcos
                                            code = ux * (maxcos * zi)
                                        end function
                                        
                                        function code(xi, yi, zi, ux, uy, maxCos)
                                        	return Float32(ux * Float32(maxCos * zi))
                                        end
                                        
                                        function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                        	tmp = ux * (maxCos * zi);
                                        end
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        ux \cdot \left(maxCos \cdot zi\right)
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 99.1%

                                          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                        2. Step-by-step derivation
                                          1. associate-+l+99.1%

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

                                            \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
                                          3. fma-define99.0%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
                                        3. Simplified99.0%

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

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

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

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

                                            \[\leadsto \color{blue}{\left(maxCos \cdot zi\right) \cdot ux} \]
                                          3. add-exp-log8.4%

                                            \[\leadsto \color{blue}{e^{\log \left(maxCos \cdot zi\right)}} \cdot ux \]
                                          4. add-exp-log8.4%

                                            \[\leadsto e^{\log \left(maxCos \cdot zi\right)} \cdot \color{blue}{e^{\log ux}} \]
                                          5. prod-exp8.4%

                                            \[\leadsto \color{blue}{e^{\log \left(maxCos \cdot zi\right) + \log ux}} \]
                                        8. Applied egg-rr8.4%

                                          \[\leadsto \color{blue}{e^{\log \left(maxCos \cdot zi\right) + \log ux}} \]
                                        9. Step-by-step derivation
                                          1. +-commutative8.4%

                                            \[\leadsto e^{\color{blue}{\log ux + \log \left(maxCos \cdot zi\right)}} \]
                                          2. exp-sum8.4%

                                            \[\leadsto \color{blue}{e^{\log ux} \cdot e^{\log \left(maxCos \cdot zi\right)}} \]
                                          3. rem-exp-log8.4%

                                            \[\leadsto \color{blue}{ux} \cdot e^{\log \left(maxCos \cdot zi\right)} \]
                                          4. rem-exp-log12.7%

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

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

                                        Alternative 21: 11.7% accurate, 92.2× 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 99.1%

                                          \[\left(\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot xi + \left(\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right)}\right) \cdot yi\right) + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
                                        2. Step-by-step derivation
                                          1. associate-+l+99.1%

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

                                            \[\leadsto \color{blue}{\cos \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \left(\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)} \cdot xi\right)} + \left(\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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right) \]
                                          3. fma-define99.0%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\left(uy \cdot 2\right) \cdot \pi\right), \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)} \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 + \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)} \]
                                        3. Simplified99.0%

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

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

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

                                        Reproduce

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