UniformSampleCone 2

Percentage Accurate: 98.9% → 98.9%
Time: 26.3s
Alternatives: 23
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := uy \cdot \left(2 \cdot \pi\right)\\
{\left(1 + \left(1 - ux\right) \cdot \left(\left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)\right)}^{0.5} \cdot \left(yi \cdot \sin t\_0 + xi \cdot \cos t\_0\right) + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)
\end{array}
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Applied egg-rr99.0%

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

Alternative 2: 98.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := uy \cdot \left(2 \cdot \pi\right)\\
\left(yi \cdot \sin t\_0 + xi \cdot \cos t\_0\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \cdot \left(ux + -1\right)\right)\right)\right)\right)} + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)
\end{array}
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Final simplification99.0%

    \[\leadsto \left(yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) + xi \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \cdot \left(ux + -1\right)\right)\right)\right)\right)} + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right) \]
  5. 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)\\ xi \cdot \cos t\_0 + \left(yi \cdot \sin t\_0 + \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))))
   (+
    (* xi (cos t_0))
    (+ (* yi (sin t_0)) (* (* 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 (xi * cosf(t_0)) + ((yi * sinf(t_0)) + ((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(xi * cos(t_0)) + Float32(Float32(yi * sin(t_0)) + 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 = (xi * cos(t_0)) + ((yi * sin(t_0)) + ((ux * maxCos) * ((single(1.0) - ux) * zi)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(uy \cdot \pi\right)\\
xi \cdot \cos t\_0 + \left(yi \cdot \sin t\_0 + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)
\end{array}
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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. +-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 \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
    2. associate-+l+N/A

      \[\leadsto xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + \color{blue}{\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
    3. +-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) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    4. *-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)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    5. 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 \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    6. *-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 \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    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}\left(\right)\right)\right)\right)\right), \left(yi \cdot \sin \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)\right) \]
    8. 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 \color{blue}{\mathsf{PI}\left(\right)}\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\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(\left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right), \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right)\right) \]
  6. Simplified98.9%

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

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

Alternative 4: 97.0% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

      \[\leadsto \color{blue}{{\left(1 + \left(1 - ux\right) \cdot \left(\left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)\right)}^{0.5} \cdot \left(yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) + xi \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)} \]
    5. 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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    6. 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(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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}{1}, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      11. PI-lowering-PI.f3299.1%

        \[\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    7. Simplified99.1%

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

      \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(xi + 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)}, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(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)\right), \mathsf{*.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \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)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(yi \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      6. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(uy, \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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      11. +-lowering-+.f32N/A

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

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

    if 0.00749999983 < 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. Simplified98.0%

      \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr98.0%

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

      \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(\frac{1}{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)}\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)}\right)\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      3. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      4. cos-lowering-cos.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      5. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      6. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      7. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      9. sin-lowering-sin.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
      12. PI-lowering-PI.f3289.8%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(1, \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)\right)\right) \]
    7. Simplified89.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{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 simplification97.4%

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

Alternative 5: 95.8% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
t_0 := uy \cdot \left(2 \cdot \pi\right)\\
yi \cdot \sin t\_0 + \left(xi \cdot \cos t\_0 + ux \cdot \left(maxCos \cdot zi\right)\right)
\end{array}
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

    \[\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. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto maxCos \cdot \left(ux \cdot zi\right) + \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)} \]
    2. associate-+r+N/A

      \[\leadsto \left(maxCos \cdot \left(ux \cdot zi\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)} \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\left(maxCos \cdot \left(ux \cdot zi\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) \]
  8. Applied egg-rr96.8%

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

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

Alternative 6: 97.0% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

      \[\leadsto \color{blue}{{\left(1 + \left(1 - ux\right) \cdot \left(\left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)\right)}^{0.5} \cdot \left(yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) + xi \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)} \]
    5. 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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    6. 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(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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}{1}, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      11. PI-lowering-PI.f3299.1%

        \[\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    7. Simplified99.1%

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

      \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(xi + 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)}, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(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)\right), \mathsf{*.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      2. *-lowering-*.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \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)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      3. +-lowering-+.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(yi \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      6. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(uy, \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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      11. +-lowering-+.f32N/A

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

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

    if 0.00749999983 < 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. Simplified98.0%

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

        \[\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. Simplified89.8%

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

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

Alternative 7: 90.0% accurate, 3.6× speedup?

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

\\
maxCos \cdot \left(ux \cdot zi\right) + \left(yi \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) + \left(xi + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

    \[\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. Taylor expanded in uy around 0

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(-2 \cdot \left({uy}^{2} \cdot \left(xi \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), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    2. associate-*r*N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(\left(-2 \cdot {uy}^{2}\right) \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\left(-2 \cdot {uy}^{2}\right), \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left({uy}^{2}\right)\right), \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \left(uy \cdot uy\right)\right), \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    6. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \left({\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), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    10. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
    11. PI-lowering-PI.f3292.1%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \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(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right) \]
  9. Simplified92.1%

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

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

Alternative 8: 88.9% accurate, 11.2× speedup?

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

\\
\left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right) + \left(xi + uy \cdot \left(yi \cdot \left(2 \cdot \pi\right) + uy \cdot \left(xi \cdot \left(-2 \cdot \left(\pi \cdot \pi\right)\right) + \left(yi \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(uy \cdot -1.3333333333333333\right)\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Applied egg-rr99.0%

    \[\leadsto \color{blue}{{\left(1 + \left(1 - ux\right) \cdot \left(\left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)\right)}^{0.5} \cdot \left(yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) + xi \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)} \]
  5. 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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
  6. 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(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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}{1}, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    11. PI-lowering-PI.f3298.9%

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

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

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(xi + 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)}, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(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)\right), \mathsf{*.f32}\left(\color{blue}{\mathsf{\_.f32}\left(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \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)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\left(yi \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    6. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \left(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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{*.f32}\left(uy, \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)\right)\right), \mathsf{*.f32}\left(\mathsf{\_.f32}\left(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    11. +-lowering-+.f32N/A

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

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

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

Alternative 9: 86.2% accurate, 12.5× speedup?

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

\\
\left(xi + maxCos \cdot \left(ux \cdot zi\right)\right) + uy \cdot \left(2 \cdot \left(yi \cdot \pi\right) + uy \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(xi \cdot -2\right) + -1.3333333333333333 \cdot \left(\left(\pi \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(yi \cdot uy\right)\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

    \[\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. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{xi + \left(maxCos \cdot \left(ux \cdot zi\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)} \]
  8. Step-by-step derivation
    1. associate-+r+N/A

      \[\leadsto \left(xi + maxCos \cdot \left(ux \cdot zi\right)\right) + \color{blue}{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)} \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\left(xi + maxCos \cdot \left(ux \cdot zi\right)\right), \color{blue}{\left(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)}\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \left(maxCos \cdot \left(ux \cdot zi\right)\right)\right), \left(\color{blue}{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)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \left(ux \cdot zi\right)\right)\right), \left(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)\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right), \left(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)\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), \mathsf{*.f32}\left(uy, \color{blue}{\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)\right) \]
    7. +-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(uy, \mathsf{+.f32}\left(\left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \color{blue}{\left(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)\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(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(yi \cdot \mathsf{PI}\left(\right)\right)\right), \left(\color{blue}{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)\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right), \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \left(\mathsf{PI}\left(\right) \cdot yi\right)\right), \left(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)\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(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI}\left(\right), yi\right)\right), \left(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)\right)\right) \]
    11. PI-lowering-PI.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(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), yi\right)\right), \left(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)\right)\right) \]
  9. Simplified88.6%

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

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

Alternative 10: 85.0% accurate, 14.9× speedup?

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

\\
uy \cdot \left(xi \cdot \left(uy \cdot \left(-2 \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \frac{yi \cdot \pi}{xi}\right)\right) + \left(xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

    \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
  6. Taylor expanded in maxCos 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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \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) + \color{blue}{xi} \]
    2. +-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
  8. Simplified87.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 85.4% accurate, 15.9× speedup?

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

\\
\left(xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) + uy \cdot \left(2 \cdot \left(yi \cdot \pi\right) + -2 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot xi\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

    \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
  6. Taylor expanded in maxCos 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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \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) + \color{blue}{xi} \]
    2. +-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
  8. Simplified87.7%

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

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

Alternative 12: 82.8% accurate, 18.4× speedup?

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

\\
xi + \left(maxCos \cdot \left(ux \cdot zi\right) + uy \cdot \left(2 \cdot \left(yi \cdot \pi\right) + -2 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot xi\right)\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

    \[\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. Taylor expanded in uy around 0

    \[\leadsto \color{blue}{xi + \left(maxCos \cdot \left(ux \cdot zi\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 zi\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 zi\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. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\mathsf{*.f32}\left(maxCos, \left(ux \cdot zi\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(maxCos, \mathsf{*.f32}\left(ux, zi\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) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\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) \]
    6. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\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) \]
    7. *-lowering-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 59.5% accurate, 20.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := xi + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\\ \mathbf{if}\;xi \leq -1.4999999523982838 \cdot 10^{-22}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;xi \leq 4.720000108707208 \cdot 10^{-19}:\\ \;\;\;\;2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ xi (* (* -2.0 (* uy uy)) (* xi (* PI PI))))))
   (if (<= xi -1.4999999523982838e-22)
     t_0
     (if (<= xi 4.720000108707208e-19) (* 2.0 (* yi (* uy PI))) t_0))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = xi + ((-2.0f * (uy * uy)) * (xi * (((float) M_PI) * ((float) M_PI))));
	float tmp;
	if (xi <= -1.4999999523982838e-22f) {
		tmp = t_0;
	} else if (xi <= 4.720000108707208e-19f) {
		tmp = 2.0f * (yi * (uy * ((float) M_PI)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(xi + Float32(Float32(Float32(-2.0) * Float32(uy * uy)) * Float32(xi * Float32(Float32(pi) * Float32(pi)))))
	tmp = Float32(0.0)
	if (xi <= Float32(-1.4999999523982838e-22))
		tmp = t_0;
	elseif (xi <= Float32(4.720000108707208e-19))
		tmp = Float32(Float32(2.0) * Float32(yi * Float32(uy * Float32(pi))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = xi + ((single(-2.0) * (uy * uy)) * (xi * (single(pi) * single(pi))));
	tmp = single(0.0);
	if (xi <= single(-1.4999999523982838e-22))
		tmp = t_0;
	elseif (xi <= single(4.720000108707208e-19))
		tmp = single(2.0) * (yi * (uy * single(pi)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := xi + \left(-2 \cdot \left(uy \cdot uy\right)\right) \cdot \left(xi \cdot \left(\pi \cdot \pi\right)\right)\\
\mathbf{if}\;xi \leq -1.4999999523982838 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;xi \leq 4.720000108707208 \cdot 10^{-19}:\\
\;\;\;\;2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if xi < -1.5e-22 or 4.7200001e-19 < xi

    1. Initial program 99.2%

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

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

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \color{blue}{\left({\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right) \]
      8. unpow2N/A

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

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

        \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      11. PI-lowering-PI.f3273.5%

        \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, uy\right)\right), \mathsf{*.f32}\left(xi, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right)\right)\right)\right) \]
    14. Simplified73.5%

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

    if -1.5e-22 < xi < 4.7200001e-19

    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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in uy around 0

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified86.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 59.5% accurate, 20.0× speedup?

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

\\
\begin{array}{l}
t_0 := xi \cdot \left(1 + \left(\pi \cdot \pi\right) \cdot \left(-2 \cdot \left(uy \cdot uy\right)\right)\right)\\
\mathbf{if}\;xi \leq -1.4999999523982838 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;xi \leq 4.720000108707208 \cdot 10^{-19}:\\
\;\;\;\;2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if xi < -1.5e-22 or 4.7200001e-19 < xi

    1. Initial program 99.2%

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

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

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(-2, \color{blue}{\left({uy}^{2}\right)}\right)\right)\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(-2, \left(uy \cdot \color{blue}{uy}\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f3273.3%

        \[\leadsto \mathsf{*.f32}\left(xi, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(uy, \color{blue}{uy}\right)\right)\right)\right)\right) \]
    11. Simplified73.3%

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

    if -1.5e-22 < xi < 4.7200001e-19

    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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in uy around 0

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified86.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 61.3% accurate, 21.9× speedup?

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

\\
\begin{array}{l}
t_0 := 2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;yi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if yi < -9.99999982e-15 or 1.99999999e-11 < yi

    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.1%

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

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified85.8%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
    11. Simplified56.5%

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

    if -9.99999982e-15 < yi < 1.99999999e-11

    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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr99.0%

      \[\leadsto \color{blue}{{\left(1 + \left(1 - ux\right) \cdot \left(\left(\left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) \cdot \left(ux + -1\right)\right)\right)}^{0.5} \cdot \left(yi \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) + xi \cdot \cos \left(uy \cdot \left(2 \cdot \pi\right)\right)\right) + \left(1 - ux\right) \cdot \left(maxCos \cdot \left(ux \cdot zi\right)\right)} \]
    5. 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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    6. 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(1, ux\right)}, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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}{1}, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, \color{blue}{ux}\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
      11. PI-lowering-PI.f3299.0%

        \[\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(1, ux\right), \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, zi\right)\right)\right)\right) \]
    7. Simplified99.0%

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\left(\left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \cdot maxCos\right), xi\right) \]
      4. *-commutativeN/A

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

        \[\leadsto \mathsf{+.f32}\left(\left(\left(zi \cdot \left(1 - ux\right)\right) \cdot \left(ux \cdot maxCos\right)\right), xi\right) \]
      6. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right), \left(maxCos \cdot ux\right)\right), xi\right) \]
      10. *-lowering-*.f3268.6%

        \[\leadsto \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(zi, \mathsf{\_.f32}\left(1, ux\right)\right), \mathsf{*.f32}\left(maxCos, ux\right)\right), xi\right) \]
    10. Simplified68.6%

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

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

Alternative 16: 81.3% accurate, 24.3× speedup?

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

\\
\left(xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) + uy \cdot \left(yi \cdot \left(2 \cdot \pi\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

    \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
  6. Taylor expanded in maxCos 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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \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) + \color{blue}{xi} \]
    2. +-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
  8. Simplified87.7%

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

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

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

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

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

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

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

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

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

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

Alternative 17: 81.3% accurate, 24.3× speedup?

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

\\
\left(xi + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) \cdot zi\right)\right) + 2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

    \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
  6. Taylor expanded in maxCos 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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \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) + \color{blue}{xi} \]
    2. +-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
  8. Simplified87.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 77.6% accurate, 24.3× speedup?

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

\\
xi + uy \cdot \left(2 \cdot \left(yi \cdot \pi\right) + -2 \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(uy \cdot xi\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

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

    \[\leadsto \color{blue}{xi + 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)} \]
  7. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \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) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \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) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \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) \]
    4. *-lowering-*.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(-2, \left(\left(uy \cdot xi\right) \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), \left(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(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(\left(uy \cdot xi\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \left(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(uy, \mathsf{+.f32}\left(\mathsf{*.f32}\left(-2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(uy, xi\right), \left({\mathsf{PI}\left(\right)}^{2}\right)\right)\right), \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
    8. unpow2N/A

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{xi + uy \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)} \]
  9. Final simplification80.9%

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

Alternative 19: 59.5% accurate, 27.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\ \mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;yi \leq 1.9999999920083944 \cdot 10^{-11}:\\ \;\;\;\;xi + maxCos \cdot \left(ux \cdot zi\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* 2.0 (* yi (* uy PI)))))
   (if (<= yi -9.9999998245167e-15)
     t_0
     (if (<= yi 1.9999999920083944e-11) (+ xi (* maxCos (* ux zi))) t_0))))
float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
	float t_0 = 2.0f * (yi * (uy * ((float) M_PI)));
	float tmp;
	if (yi <= -9.9999998245167e-15f) {
		tmp = t_0;
	} else if (yi <= 1.9999999920083944e-11f) {
		tmp = xi + (maxCos * (ux * zi));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(xi, yi, zi, ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) * Float32(yi * Float32(uy * Float32(pi))))
	tmp = Float32(0.0)
	if (yi <= Float32(-9.9999998245167e-15))
		tmp = t_0;
	elseif (yi <= Float32(1.9999999920083944e-11))
		tmp = Float32(xi + Float32(maxCos * Float32(ux * zi)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(xi, yi, zi, ux, uy, maxCos)
	t_0 = single(2.0) * (yi * (uy * single(pi)));
	tmp = single(0.0);
	if (yi <= single(-9.9999998245167e-15))
		tmp = t_0;
	elseif (yi <= single(1.9999999920083944e-11))
		tmp = xi + (maxCos * (ux * zi));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)\\
\mathbf{if}\;yi \leq -9.9999998245167 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;yi \leq 1.9999999920083944 \cdot 10^{-11}:\\
\;\;\;\;xi + maxCos \cdot \left(ux \cdot zi\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if yi < -9.99999982e-15 or 1.99999999e-11 < yi

    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.1%

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

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

      \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
    6. Taylor expanded in maxCos 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)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \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) + \color{blue}{xi} \]
      2. +-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
    8. Simplified85.8%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
    11. Simplified56.5%

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

    if -9.99999982e-15 < yi < 1.99999999e-11

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

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

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

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

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

        \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{*.f32}\left(maxCos, \mathsf{*.f32}\left(ux, \color{blue}{zi}\right)\right)\right) \]
    9. Simplified66.4%

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

Alternative 20: 78.8% accurate, 30.7× speedup?

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

\\
xi + \left(maxCos \cdot \left(ux \cdot zi\right) + 2 \cdot \left(uy \cdot \left(yi \cdot \pi\right)\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

    \[\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. 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 zi\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 zi\right)\right)}\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(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)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(xi, \mathsf{+.f32}\left(\left(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)\right) \]
    4. *-lowering-*.f32N/A

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

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

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

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

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

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

Alternative 21: 31.7% accurate, 65.9× speedup?

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

\\
2 \cdot \left(yi \cdot \left(uy \cdot \pi\right)\right)
\end{array}
Derivation
  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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in uy around 0

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

    \[\leadsto \color{blue}{\left(\left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + xi \cdot \sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)}\right) + uy \cdot \left(\sqrt{1 + \left(maxCos \cdot maxCos\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(\left(1 - ux\right) \cdot \left(ux + -1\right)\right)\right)} \cdot \left(-2 \cdot \left(\left(uy \cdot xi\right) \cdot \left(\pi \cdot \pi\right)\right) + 2 \cdot \left(\pi \cdot yi\right)\right)\right)} \]
  6. Taylor expanded in maxCos 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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \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) + \color{blue}{xi} \]
    2. +-commutativeN/A

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

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

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

      \[\leadsto \mathsf{+.f32}\left(\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), \color{blue}{\left(xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)}\right) \]
  8. Simplified87.7%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(yi, \mathsf{*.f32}\left(uy, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  11. Simplified30.1%

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

Alternative 22: 12.1% accurate, 92.2× speedup?

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

\\
zi \cdot \left(ux \cdot maxCos\right)
\end{array}
Derivation
  1. Initial program 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(maxCos \cdot \left(maxCos \cdot \left(ux \cdot \left(ux \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) + ux \cdot \left(\left(1 - ux\right) \cdot \left(maxCos \cdot zi\right)\right)} \]
  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.7%

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

    \[\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 \mathsf{*.f32}\left(\mathsf{*.f32}\left(maxCos, ux\right), \color{blue}{zi}\right) \]
  8. Step-by-step derivation
    1. Simplified11.9%

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

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

    Alternative 23: 12.1% accurate, 92.2× speedup?

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

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

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

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

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

    Reproduce

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