UniformSampleCone 2

Percentage Accurate: 98.9% → 98.9%
Time: 21.0s
Alternatives: 22
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 22 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.8× speedup?

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

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

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

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

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

Alternative 2: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathsf{fma}\left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right), ux, {\left(1 + ux \cdot \left(\left(1 - ux\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)\right)\right)\right)}^{0.5} \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 (* 2.0 (* uy PI))))
   (fma
    (* (- 1.0 ux) (* maxCos zi))
    ux
    (*
     (pow
      (+ 1.0 (* ux (* (- 1.0 ux) (* ux (* maxCos (* maxCos (+ ux -1.0)))))))
      0.5)
     (+ (* (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 = 2.0f * (uy * ((float) M_PI));
	return fmaf(((1.0f - ux) * (maxCos * zi)), ux, (powf((1.0f + (ux * ((1.0f - ux) * (ux * (maxCos * (maxCos * (ux + -1.0f))))))), 0.5f) * ((cosf(t_0) * xi) + (sinf(t_0) * yi))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	return fma(Float32(Float32(Float32(1.0) - ux) * Float32(maxCos * zi)), ux, Float32((Float32(Float32(1.0) + Float32(ux * Float32(Float32(Float32(1.0) - ux) * Float32(ux * Float32(maxCos * Float32(maxCos * Float32(ux + Float32(-1.0)))))))) ^ Float32(0.5)) * Float32(Float32(cos(t_0) * xi) + Float32(sin(t_0) * yi))))
end
\begin{array}{l}

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

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

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

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

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

Alternative 3: 98.7% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    7. --lowering--.f3298.7%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr98.7%

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

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

Alternative 4: 98.7% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

    \[\leadsto \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot yi + \left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) \]
  8. 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)\\ \left(\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\right) + zi \cdot \left(ux \cdot \left(maxCos \cdot \left(1 - ux\right)\right)\right) \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* uy PI))))
   (+
    (+ (* (cos t_0) xi) (* (sin t_0) yi))
    (* zi (* ux (* maxCos (- 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 ((cosf(t_0) * xi) + (sinf(t_0) * yi)) + (zi * (ux * (maxCos * (1.0f - ux))));
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	return Float32(Float32(Float32(cos(t_0) * xi) + Float32(sin(t_0) * yi)) + Float32(zi * Float32(ux * Float32(maxCos * Float32(Float32(1.0) - ux)))))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = single(2.0) * (uy * single(pi));
	tmp = ((cos(t_0) * xi) + (sin(t_0) * yi)) + (zi * (ux * (maxCos * (single(1.0) - ux))));
end
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right), ux\right), zi\right)\right) \]
    11. PI-lowering-PI.f3298.6%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right), ux\right), zi\right)\right) \]
  5. Simplified98.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(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi \]
  6. Final simplification98.6%

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

Alternative 6: 95.9% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \left(\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\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))))
   (+ (+ (* (cos t_0) xi) (* (sin t_0) yi)) (* 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 ((cosf(t_0) * xi) + (sinf(t_0) * yi)) + (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(cos(t_0) * xi) + Float32(sin(t_0) * yi)) + Float32(maxCos * Float32(ux * zi)))
end
function tmp = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = single(2.0) * (uy * single(pi));
	tmp = ((cos(t_0) * xi) + (sin(t_0) * yi)) + (maxCos * (ux * zi));
end
\begin{array}{l}

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \color{blue}{\left(maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
  6. Simplified96.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) + maxCos \cdot \left(ux \cdot zi\right)} \]
  7. Final simplification96.0%

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

Alternative 7: 96.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathbf{if}\;uy \leq 0.0032500000670552254:\\ \;\;\;\;\left(xi + \left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right) + uy \cdot \left(xi \cdot \left(\left(\pi \cdot \pi\right) \cdot -2\right) + uy \cdot \left(-1.3333333333333333 \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* uy PI))))
   (if (<= uy 0.0032500000670552254)
     (+
      (+ xi (* (* maxCos (- 1.0 ux)) (* ux zi)))
      (*
       uy
       (+
        (* PI (* 2.0 yi))
        (*
         uy
         (+
          (* xi (* (* PI PI) -2.0))
          (* uy (* -1.3333333333333333 (* yi (* PI (* PI PI))))))))))
     (+ (* (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 = 2.0f * (uy * ((float) M_PI));
	float tmp;
	if (uy <= 0.0032500000670552254f) {
		tmp = (xi + ((maxCos * (1.0f - ux)) * (ux * zi))) + (uy * ((((float) M_PI) * (2.0f * yi)) + (uy * ((xi * ((((float) M_PI) * ((float) M_PI)) * -2.0f)) + (uy * (-1.3333333333333333f * (yi * (((float) M_PI) * (((float) M_PI) * ((float) M_PI))))))))));
	} else {
		tmp = (cosf(t_0) * xi) + (sinf(t_0) * yi);
	}
	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.0032500000670552254))
		tmp = Float32(Float32(xi + Float32(Float32(maxCos * Float32(Float32(1.0) - ux)) * Float32(ux * zi))) + Float32(uy * Float32(Float32(Float32(pi) * Float32(Float32(2.0) * yi)) + Float32(uy * Float32(Float32(xi * Float32(Float32(Float32(pi) * Float32(pi)) * Float32(-2.0))) + Float32(uy * Float32(Float32(-1.3333333333333333) * Float32(yi * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))))))))));
	else
		tmp = Float32(Float32(cos(t_0) * xi) + Float32(sin(t_0) * yi));
	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.0032500000670552254))
		tmp = (xi + ((maxCos * (single(1.0) - ux)) * (ux * zi))) + (uy * ((single(pi) * (single(2.0) * yi)) + (uy * ((xi * ((single(pi) * single(pi)) * single(-2.0))) + (uy * (single(-1.3333333333333333) * (yi * (single(pi) * (single(pi) * single(pi))))))))));
	else
		tmp = (cos(t_0) * xi) + (sin(t_0) * yi);
	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.0032500000670552254:\\
\;\;\;\;\left(xi + \left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right) + uy \cdot \left(xi \cdot \left(\left(\pi \cdot \pi\right) \cdot -2\right) + uy \cdot \left(-1.3333333333333333 \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\cos t\_0 \cdot xi + \sin t\_0 \cdot yi\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.00325000007

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3299.0%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.0%

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

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

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

    if 0.00325000007 < 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. Simplified97.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
      11. PI-lowering-PI.f3295.1%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    6. Simplified95.1%

      \[\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 simplification98.1%

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

Alternative 8: 93.3% accurate, 3.3× speedup?

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

\\
\left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot xi + ux \cdot \left(maxCos \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right) + -1.3333333333333333 \cdot \left(uy \cdot \left(uy \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    7. --lowering--.f3298.7%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr98.7%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(2 \cdot yi\right) \cdot \mathsf{PI}\left(\right)\right), \left(\color{blue}{{uy}^{2}} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)\right) \]
    8. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(2, yi\right)\right), \left({uy}^{\color{blue}{2}} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)\right) \]
    12. *-commutativeN/A

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

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

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

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

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

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

Alternative 9: 93.3% accurate, 3.3× speedup?

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

\\
\left(\cos \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) + uy \cdot \left(2 \cdot \left(\pi \cdot yi\right) + \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI}\left(\right)\right)\right), \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)\right) \]
    7. associate-*r*N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left({uy}^{2}\right)\right), \left(\color{blue}{yi} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \left(uy \cdot uy\right)\right), \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\left({\mathsf{PI}\left(\right)}^{3}\right)}\right)\right)\right)\right)\right) \]
    13. cube-multN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right)\right)\right)\right) \]
    14. unpow2N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left({\color{blue}{\mathsf{PI}\left(\right)}}^{2}\right)\right)\right)\right)\right)\right)\right) \]
    17. unpow2N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right)\right)\right)\right) \]
    19. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right)\right) \]
    20. PI-lowering-PI.f3293.0%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\frac{-4}{3}, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right)\right)\right) \]
  9. Simplified93.0%

    \[\leadsto \left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \cos \left(2 \cdot \left(uy \cdot \pi\right)\right)\right) + \color{blue}{uy \cdot \left(2 \cdot \left(yi \cdot \pi\right) + \left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)} \]
  10. Final simplification93.0%

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

Alternative 10: 92.9% accurate, 3.5× speedup?

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

\\
\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot yi + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right) + xi \cdot \left(1 + \left(\pi \cdot \pi\right) \cdot \left(-2 \cdot \left(uy \cdot uy\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left({uy}^{2}\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    5. unpow2N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    7. unpow2N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    9. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    10. PI-lowering-PI.f3292.9%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  9. Simplified92.9%

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

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

Alternative 11: 91.4% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) \cdot zi\\ t_1 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathbf{if}\;yi \leq -9.99999983775159 \cdot 10^{-18}:\\ \;\;\;\;\sin t\_1 \cdot yi + \left(xi + \left(ux \cdot maxCos\right) \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos t\_1 \cdot xi + ux \cdot \left(maxCos \cdot t\_0\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right)\right)\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (- 1.0 ux) zi)) (t_1 (* 2.0 (* uy PI))))
   (if (<= yi -9.99999983775159e-18)
     (+ (* (sin t_1) yi) (+ xi (* (* ux maxCos) t_0)))
     (+ (+ (* (cos t_1) xi) (* ux (* maxCos t_0))) (* uy (* PI (* 2.0 yi)))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = (1.0f - ux) * zi;
	float t_1 = 2.0f * (uy * ((float) M_PI));
	float tmp;
	if (yi <= -9.99999983775159e-18f) {
		tmp = (sinf(t_1) * yi) + (xi + ((ux * maxCos) * t_0));
	} else {
		tmp = ((cosf(t_1) * xi) + (ux * (maxCos * t_0))) + (uy * (((float) M_PI) * (2.0f * yi)));
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(1.0) - ux) * zi)
	t_1 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	tmp = Float32(0.0)
	if (yi <= Float32(-9.99999983775159e-18))
		tmp = Float32(Float32(sin(t_1) * yi) + Float32(xi + Float32(Float32(ux * maxCos) * t_0)));
	else
		tmp = Float32(Float32(Float32(cos(t_1) * xi) + Float32(ux * Float32(maxCos * t_0))) + Float32(uy * Float32(Float32(pi) * Float32(Float32(2.0) * yi))));
	end
	return tmp
end
function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = (single(1.0) - ux) * zi;
	t_1 = single(2.0) * (uy * single(pi));
	tmp = single(0.0);
	if (yi <= single(-9.99999983775159e-18))
		tmp = (sin(t_1) * yi) + (xi + ((ux * maxCos) * t_0));
	else
		tmp = ((cos(t_1) * xi) + (ux * (maxCos * t_0))) + (uy * (single(pi) * (single(2.0) * yi)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(1 - ux\right) \cdot zi\\
t_1 := 2 \cdot \left(uy \cdot \pi\right)\\
\mathbf{if}\;yi \leq -9.99999983775159 \cdot 10^{-18}:\\
\;\;\;\;\sin t\_1 \cdot yi + \left(xi + \left(ux \cdot maxCos\right) \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\cos t\_1 \cdot xi + ux \cdot \left(maxCos \cdot t\_0\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if yi < -9.99999984e-18

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \left(1 - ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3292.7%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    9. Simplified92.7%

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

    if -9.99999984e-18 < yi

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3298.6%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr98.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\color{blue}{2} \cdot yi\right)\right)\right)\right) \]
      9. *-lowering-*.f3292.4%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(2, \color{blue}{yi}\right)\right)\right)\right) \]
    11. Simplified92.4%

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

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

Alternative 12: 91.4% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\\ t_1 := 2 \cdot \left(uy \cdot \pi\right)\\ \mathbf{if}\;yi \leq -9.99999983775159 \cdot 10^{-18}:\\ \;\;\;\;\sin t\_1 \cdot yi + \left(xi + t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos t\_1 \cdot xi + t\_0\right) + 2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\right)\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (* ux maxCos) (* (- 1.0 ux) zi))) (t_1 (* 2.0 (* uy PI))))
   (if (<= yi -9.99999983775159e-18)
     (+ (* (sin t_1) yi) (+ xi t_0))
     (+ (+ (* (cos t_1) xi) t_0) (* 2.0 (* uy (* PI yi)))))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = (ux * maxCos) * ((1.0f - ux) * zi);
	float t_1 = 2.0f * (uy * ((float) M_PI));
	float tmp;
	if (yi <= -9.99999983775159e-18f) {
		tmp = (sinf(t_1) * yi) + (xi + t_0);
	} else {
		tmp = ((cosf(t_1) * xi) + t_0) + (2.0f * (uy * (((float) M_PI) * yi)));
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(ux * maxCos) * Float32(Float32(Float32(1.0) - ux) * zi))
	t_1 = Float32(Float32(2.0) * Float32(uy * Float32(pi)))
	tmp = Float32(0.0)
	if (yi <= Float32(-9.99999983775159e-18))
		tmp = Float32(Float32(sin(t_1) * yi) + Float32(xi + t_0));
	else
		tmp = Float32(Float32(Float32(cos(t_1) * xi) + t_0) + Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * yi))));
	end
	return tmp
end
function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = (ux * maxCos) * ((single(1.0) - ux) * zi);
	t_1 = single(2.0) * (uy * single(pi));
	tmp = single(0.0);
	if (yi <= single(-9.99999983775159e-18))
		tmp = (sin(t_1) * yi) + (xi + t_0);
	else
		tmp = ((cos(t_1) * xi) + t_0) + (single(2.0) * (uy * (single(pi) * yi)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\\
t_1 := 2 \cdot \left(uy \cdot \pi\right)\\
\mathbf{if}\;yi \leq -9.99999983775159 \cdot 10^{-18}:\\
\;\;\;\;\sin t\_1 \cdot yi + \left(xi + t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\cos t\_1 \cdot xi + t\_0\right) + 2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if yi < -9.99999984e-18

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \left(1 - ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3292.7%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    9. Simplified92.7%

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

    if -9.99999984e-18 < yi

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.5%

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right) \]
      4. PI-lowering-PI.f3292.3%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right) \]
    9. Simplified92.3%

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

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

Alternative 13: 91.8% accurate, 3.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;uy \leq 0.037700001150369644:\\
\;\;\;\;\left(xi + \left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right) + uy \cdot \left(xi \cdot \left(\left(\pi \cdot \pi\right) \cdot -2\right) + uy \cdot \left(-1.3333333333333333 \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0377000012

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified98.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3299.0%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.0%

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

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

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

    if 0.0377000012 < uy

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
    6. Simplified97.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \left(1 - ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
      7. --lowering--.f3263.6%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), xi\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    9. Simplified63.6%

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

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

Alternative 14: 88.9% accurate, 11.2× speedup?

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

\\
\left(xi + \left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right)\right) + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right) + uy \cdot \left(xi \cdot \left(\left(\pi \cdot \pi\right) \cdot -2\right) + uy \cdot \left(-1.3333333333333333 \cdot \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    7. --lowering--.f3298.7%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr98.7%

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

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

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

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

Alternative 15: 85.3% accurate, 15.9× speedup?

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

\\
xi + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right) + uy \cdot \left(2 \cdot \left(\pi \cdot yi\right) + \left(uy \cdot -2\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 81.4% accurate, 24.3× speedup?

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

\\
\left(maxCos \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot zi\right) + \left(xi + uy \cdot \left(\pi \cdot \left(2 \cdot yi\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\left(1 - ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
    7. --lowering--.f3298.7%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), zi\right), maxCos\right), ux\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, zi\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \color{blue}{\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right) \]
  11. Simplified80.8%

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

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

Alternative 17: 81.4% accurate, 24.3× speedup?

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

\\
xi + \left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right) + 2 \cdot \left(uy \cdot \left(\pi \cdot yi\right)\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right)\right) \]
    12. PI-lowering-PI.f3280.8%

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right) \]
  9. Simplified80.8%

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

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

Alternative 18: 78.9% accurate, 30.7× speedup?

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

\\
\left(xi + maxCos \cdot \left(ux \cdot zi\right)\right) + \left(\pi \cdot yi\right) \cdot \left(2 \cdot uy\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + {uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, ux\right)}, maxCos\right)\right), zi\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{ux}\right), maxCos\right)\right), zi\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(\mathsf{PI}\left(\right) \cdot yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\left({uy}^{2}\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\left(uy \cdot uy\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
  6. Simplified96.6%

    \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)\right)\right)} \cdot \left(\color{blue}{uy \cdot \left(2 \cdot \left(\pi \cdot yi\right) + \left(uy \cdot uy\right) \cdot \left(\left(-1.3333333333333333 \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + \left(uy \cdot uy\right) \cdot \left(-0.025396825396825397 \cdot \left(\left(\left(uy \cdot uy\right) \cdot yi\right) \cdot {\pi}^{7}\right) + \left(0.26666666666666666 \cdot yi\right) \cdot {\pi}^{5}\right)\right)\right)} + \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot xi\right) + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi \]
  7. Taylor expanded in uy around 0

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    5. PI-lowering-PI.f3280.8%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
  9. Simplified80.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{*.f32}\left(yi, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    11. PI-lowering-PI.f3278.6%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  12. Simplified78.6%

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

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

Alternative 19: 74.2% accurate, 51.2× speedup?

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

\\
xi + \left(\pi \cdot yi\right) \cdot \left(2 \cdot uy\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + {uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, ux\right)}, maxCos\right)\right), zi\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{ux}\right), maxCos\right)\right), zi\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(\mathsf{PI}\left(\right) \cdot yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \left({uy}^{2} \cdot \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\left({uy}^{2}\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\left(uy \cdot uy\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, uy\right), \left(\frac{-4}{3} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right) + {uy}^{2} \cdot \left(\frac{-8}{315} \cdot \left({uy}^{2} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{7}\right)\right) + \frac{4}{15} \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{5}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{cos.f32}\left(\mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right)\right), xi\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
  6. Simplified96.6%

    \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux \cdot \left(maxCos \cdot \left(ux \cdot \left(maxCos \cdot \left(ux + -1\right)\right)\right)\right)\right)} \cdot \left(\color{blue}{uy \cdot \left(2 \cdot \left(\pi \cdot yi\right) + \left(uy \cdot uy\right) \cdot \left(\left(-1.3333333333333333 \cdot yi\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right) + \left(uy \cdot uy\right) \cdot \left(-0.025396825396825397 \cdot \left(\left(\left(uy \cdot uy\right) \cdot yi\right) \cdot {\pi}^{7}\right) + \left(0.26666666666666666 \cdot yi\right) \cdot {\pi}^{5}\right)\right)\right)} + \cos \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot xi\right) + \left(ux \cdot \left(\left(1 - ux\right) \cdot maxCos\right)\right) \cdot zi \]
  7. Taylor expanded in uy around 0

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
    5. PI-lowering-PI.f3280.8%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(maxCos, \mathsf{+.f32}\left(ux, -1\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(ux, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), maxCos\right)\right), zi\right)\right) \]
  9. Simplified80.8%

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{*.f32}\left(yi, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. PI-lowering-PI.f3274.5%

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{*.f32}\left(yi, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  12. Simplified74.5%

    \[\leadsto \color{blue}{xi + \left(2 \cdot uy\right) \cdot \left(yi \cdot \pi\right)} \]
  13. Final simplification74.5%

    \[\leadsto xi + \left(\pi \cdot yi\right) \cdot \left(2 \cdot uy\right) \]
  14. Add Preprocessing

Alternative 20: 31.9% accurate, 65.9× speedup?

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

\\
uy \cdot \left(\pi \cdot \left(2 \cdot yi\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right)\right), \mathsf{*.f32}\left(xi, \mathsf{cos.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(yi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \]
  6. Simplified98.6%

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

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

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

      \[\leadsto \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    3. associate-*r*N/A

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

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

      \[\leadsto \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{PI}\left(\right)\right)\right)\right) \]
    6. PI-lowering-PI.f3237.8%

      \[\leadsto \mathsf{*.f32}\left(yi, \mathsf{sin.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, uy\right), \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  9. Simplified37.8%

    \[\leadsto \color{blue}{yi \cdot \sin \left(\left(2 \cdot uy\right) \cdot \pi\right)} \]
  10. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\color{blue}{2} \cdot yi\right)\right)\right) \]
    9. *-lowering-*.f3230.7%

      \[\leadsto \mathsf{*.f32}\left(uy, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(2, \color{blue}{yi}\right)\right)\right) \]
  12. Simplified30.7%

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

Alternative 21: 11.9% 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 98.7%

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \color{blue}{\left(1 - ux\right)}\right)\right) \]
    5. --lowering--.f3212.4%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, \color{blue}{ux}\right)\right)\right) \]
  6. Simplified12.4%

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

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

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

      \[\leadsto \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \color{blue}{zi}\right)\right) \]
  9. Simplified11.3%

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\left(zi \cdot maxCos\right), \color{blue}{ux}\right) \]
    5. *-lowering-*.f3211.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(zi, maxCos\right), ux\right) \]
  11. Applied egg-rr11.3%

    \[\leadsto \color{blue}{\left(zi \cdot maxCos\right) \cdot ux} \]
  12. Final simplification11.3%

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

Alternative 22: 11.9% 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 98.7%

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \color{blue}{\left(1 - ux\right)}\right)\right) \]
    5. --lowering--.f3212.4%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, \color{blue}{ux}\right)\right)\right) \]
  6. Simplified12.4%

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

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

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

      \[\leadsto \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \color{blue}{zi}\right)\right) \]
  9. Simplified11.3%

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

Reproduce

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