UniformSampleCone, y

Percentage Accurate: 57.3% → 98.7%
Time: 28.3s
Alternatives: 15
Speedup: 1.5×

Specification

?
\[\left(\left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\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(1 - ux\right) + ux \cdot maxCos\\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t_0 \cdot t_0} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
   (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* t_0 t_0))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = (1.0f - ux) + (ux * maxCos);
	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((1.0f - (t_0 * t_0)));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0))))
end
function tmp = code(ux, uy, maxCos)
	t_0 = (single(1.0) - ux) + (ux * maxCos);
	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((single(1.0) - (t_0 * t_0)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t_0 \cdot t_0}
\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 15 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: 57.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - t_0 \cdot t_0}
\end{array}
\end{array}

Alternative 1: 98.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \langle \left( \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)} \right)_{\text{binary64}} \rangle_{\text{binary32}} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (cast
  (!
   :precision
   binary64
   (*
    (sin (* uy (* 2.0 PI)))
    (sqrt
     (fma (- (fma ux maxCos 1.0) ux) (+ -1.0 (- ux (* ux maxCos))) 1.0))))))
float code(float ux, float uy, float maxCos) {
	double tmp = sin((((double) uy) * (2.0 * ((double) M_PI)))) * sqrt(fma((fma(ux, maxCos, 1.0) - ((double) ux)), (-1.0 + (((double) ux) - (((double) ux) * ((double) maxCos)))), 1.0));
	return (float) tmp;
}
function code(ux, uy, maxCos)
	tmp = Float64(sin(Float64(Float64(uy) * Float64(2.0 * pi))) * sqrt(fma(Float64(fma(ux, maxCos, 1.0) - Float64(ux)), Float64(-1.0 + Float64(Float64(ux) - Float64(Float64(ux) * Float64(maxCos)))), 1.0)))
	return Float32(tmp)
end
\begin{array}{l}

\\
\langle \left( \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)} \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\langle \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)} \rangle_{\text{binary64}} \]
  2. Final simplification98.9%

    \[\leadsto \langle \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)} \rangle_{\text{binary64}} \]

Alternative 2: 98.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \langle \left( \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 - {\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}} \right)_{\text{binary64}} \rangle_{\text{binary32}} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (cast
  (!
   :precision
   binary64
   (*
    (sin (* 2.0 (* uy PI)))
    (sqrt (- 1.0 (pow (- (fma ux maxCos 1.0) ux) 2.0)))))))
float code(float ux, float uy, float maxCos) {
	double tmp = sin((2.0 * (((double) uy) * ((double) M_PI)))) * sqrt((1.0 - pow((fma(ux, maxCos, 1.0) - ((double) ux)), 2.0)));
	return (float) tmp;
}
function code(ux, uy, maxCos)
	tmp = Float64(sin(Float64(2.0 * Float64(Float64(uy) * pi))) * sqrt(Float64(1.0 - (Float64(fma(ux, maxCos, 1.0) - Float64(ux)) ^ 2.0))))
	return Float32(tmp)
end
\begin{array}{l}

\\
\langle \left( \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 - {\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}} \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
Derivation
  1. Initial program 98.9%

    \[\langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 - \mathsf{fma}\left(ux, maxCos, 1 - ux\right) \cdot \mathsf{fma}\left(ux, maxCos, 1 - ux\right)} \rangle_{\text{binary64}} \]
  2. Step-by-step derivation
    1. sub-neg98.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-\mathsf{fma}\left(ux, maxCos, 1 - ux\right) \cdot \mathsf{fma}\left(ux, maxCos, 1 - ux\right)\right)} \rangle_{\text{binary64}} \]
    2. pow298.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-{\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right)\right)}^{2}\right)} \rangle_{\text{binary64}} \]
    3. fma-udef98.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}^{2}\right)} \rangle_{\text{binary64}} \]
    4. associate-+r-98.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-{\left(\left(ux \cdot maxCos + 1\right) - ux\right)}^{2}\right)} \rangle_{\text{binary64}} \]
    5. fma-udef98.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-{\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}\right)} \rangle_{\text{binary64}} \]
  3. Applied egg-rr98.9%

    \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 + \left(-{\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}\right)} \rangle_{\text{binary64}} \]
  4. Step-by-step derivation
    1. unsub-neg98.9%

      \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 - {\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}} \rangle_{\text{binary64}} \]
  5. Simplified98.9%

    \[\leadsto \langle \sin \left(\left(\pi \cdot uy\right) \cdot 2\right) \cdot \sqrt{1 - {\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}} \rangle_{\text{binary64}} \]
  6. Final simplification98.9%

    \[\leadsto \langle \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 - {\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right)}^{2}} \rangle_{\text{binary64}} \]

Alternative 3: 98.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \langle \left( \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}} \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (cast (! :precision binary64 (sin (* uy (* 2.0 PI)))))
  (sqrt
   (fma
    ux
    (+ 1.0 (- (- 1.0 maxCos) maxCos))
    (* (* ux ux) (* (- 1.0 maxCos) (+ maxCos -1.0)))))))
float code(float ux, float uy, float maxCos) {
	double tmp = sin((((double) uy) * (2.0 * ((double) M_PI))));
	return ((float) tmp) * sqrtf(fmaf(ux, (1.0f + ((1.0f - maxCos) - maxCos)), ((ux * ux) * ((1.0f - maxCos) * (maxCos + -1.0f)))));
}
function code(ux, uy, maxCos)
	tmp = sin(Float64(Float64(uy) * Float64(2.0 * pi)))
	return Float32(Float32(tmp) * sqrt(fma(ux, Float32(Float32(1.0) + Float32(Float32(Float32(1.0) - maxCos) - maxCos)), Float32(Float32(ux * ux) * Float32(Float32(Float32(1.0) - maxCos) * Float32(maxCos + Float32(-1.0)))))))
end
\begin{array}{l}

\\
\langle \left( \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \right)_{\text{binary64}} \rangle_{\text{binary32}} \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Step-by-step derivation
    1. fma-def98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
    2. associate--l+98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    3. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    4. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    5. metadata-eval98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    6. distribute-neg-in98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    7. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    8. metadata-eval98.3%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    10. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    11. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    12. unpow298.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    13. *-commutative98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
    14. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
    15. metadata-eval98.3%

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. rewrite-binary32/binary6498.4%

      \[\leadsto \color{blue}{\langle \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \rangle_{\text{binary64}} \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  8. Applied rewrite-once98.4%

    \[\leadsto \color{blue}{\langle \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right)} \rangle_{\text{binary64}}} \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} \]
  9. Final simplification98.4%

    \[\leadsto \langle \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \rangle_{\text{binary64}} \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \]

Alternative 4: 98.3% accurate, 0.8× speedup?

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

\\
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 + \left(1 - maxCos\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Final simplification98.3%

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 + \left(1 - maxCos\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)} \]

Alternative 5: 98.3% accurate, 0.8× speedup?

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

\\
\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Step-by-step derivation
    1. fma-def98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
    2. associate--l+98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    3. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    4. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    5. metadata-eval98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    6. distribute-neg-in98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    7. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    8. metadata-eval98.3%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    10. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    11. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    12. unpow298.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    13. *-commutative98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
    14. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
    15. metadata-eval98.3%

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Taylor expanded in uy around inf 98.3%

    \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  8. Final simplification98.3%

    \[\leadsto \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]

Alternative 6: 98.3% accurate, 0.8× speedup?

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

\\
\sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2 + maxCos \cdot -2, \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Step-by-step derivation
    1. fma-def98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
    2. associate--l+98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    3. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    4. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    5. metadata-eval98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    6. distribute-neg-in98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    7. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    8. metadata-eval98.3%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    10. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    11. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    12. unpow298.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    13. *-commutative98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
    14. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
    15. metadata-eval98.3%

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Taylor expanded in uy around inf 98.3%

    \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  8. Simplified98.3%

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

    \[\leadsto \sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2 + maxCos \cdot -2, \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)} \]

Alternative 7: 95.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.0005000000237487257:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\mathsf{fma}\left(ux, 2 + maxCos \cdot -2, \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy 2) < 5.00000024e-4

    1. Initial program 58.9%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      3. +-commutative58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def58.8%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-58.9%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) - ux \cdot maxCos}, 1\right)} \]
      11. neg-sub058.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
      13. metadata-eval58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-59.0%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
    5. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
      2. associate--l+98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      3. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      4. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      5. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      6. distribute-neg-in98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      7. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      8. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-1 \cdot maxCos + \color{blue}{1}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      9. +-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      10. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      11. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      12. unpow298.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      13. *-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
      14. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
      15. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
    8. Simplified98.4%

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

    if 5.00000024e-4 < (*.f32 uy 2)

    1. Initial program 58.1%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      3. +-commutative58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
      6. +-commutative57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-57.9%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) - ux \cdot maxCos}, 1\right)} \]
      11. neg-sub057.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
      13. metadata-eval57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-57.9%

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

      \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)}} \]
    4. Taylor expanded in uy around inf 57.8%

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

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}} \]
    6. Step-by-step derivation
      1. *-commutative57.0%

        \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} \]
      2. sub-neg57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(-1\right)\right)}} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      3. metadata-eval57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      4. associate-*r*57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \]
      5. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \]
      6. associate-*r*57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(\pi \cdot 2\right) \cdot uy\right)} \]
      7. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(\color{blue}{\left(2 \cdot \pi\right)} \cdot uy\right) \]
      8. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    7. Simplified57.0%

      \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    8. Taylor expanded in ux around 0 93.9%

      \[\leadsto \sqrt{\color{blue}{-1 \cdot {ux}^{2} + 2 \cdot ux}} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
    9. Step-by-step derivation
      1. +-commutative55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux + -1 \cdot {ux}^{2}}}\right)\right) \]
      2. mul-1-neg55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux + \color{blue}{\left(-{ux}^{2}\right)}}\right)\right) \]
      3. unsub-neg55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux - {ux}^{2}}}\right)\right) \]
      4. unpow255.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right)\right) \]
    10. Simplified93.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.0005000000237487257:\\ \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\mathsf{fma}\left(ux, 2 + maxCos \cdot -2, \left(ux \cdot ux\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos + -1\right)\right)\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux}\\ \end{array} \]

Alternative 8: 98.3% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Step-by-step derivation
    1. fma-def98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
    2. associate--l+98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    3. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    4. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    5. metadata-eval98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    6. distribute-neg-in98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    7. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    8. metadata-eval98.3%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    10. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    11. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    12. unpow298.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    13. *-commutative98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
    14. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
    15. metadata-eval98.3%

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Taylor expanded in uy around inf 98.3%

    \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  8. Simplified98.2%

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

    \[\leadsto \sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)} \]

Alternative 9: 90.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(uy \cdot 2\right)\\
\mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\
\;\;\;\;t_0 \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sin t_0 \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy 2) < 0.00359999994

    1. Initial program 59.1%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg59.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in59.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
      6. +-commutative58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in59.0%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-59.1%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
    5. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
      2. associate--l+98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      3. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      4. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      5. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      6. distribute-neg-in98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      7. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      8. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-1 \cdot maxCos + \color{blue}{1}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      9. +-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      10. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      11. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      12. unpow298.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      13. *-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
      14. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
      15. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
    8. Step-by-step derivation
      1. associate-*r*96.5%

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

        \[\leadsto \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      3. *-commutative96.5%

        \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      4. +-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
      5. *-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      6. sub-neg96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      7. metadata-eval96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(maxCos + \color{blue}{-1}\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      8. unpow296.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      9. associate-*l*96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      10. distribute-lft-out96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)}} \]
      11. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(maxCos + \color{blue}{\left(-1\right)}\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      12. sub-neg96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\color{blue}{\left(maxCos - 1\right)} \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      13. *-commutative96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} + \left(2 - 2 \cdot maxCos\right)\right)} \]
      14. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)\right)} \]
      15. associate-+r-96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \color{blue}{\left(1 + \left(1 - 2 \cdot maxCos\right)\right)}\right)} \]
    9. Simplified96.4%

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

    if 0.00359999994 < (*.f32 uy 2)

    1. Initial program 57.2%

      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Taylor expanded in ux around 0 78.0%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\ \;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\\ \end{array} \]

Alternative 10: 90.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left(2 - maxCos\right) - maxCos\\
t_1 := \pi \cdot \left(uy \cdot 2\right)\\
\mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\
\;\;\;\;t_1 \cdot \sqrt{ux \cdot \left(t_0 - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sin t_1 \cdot \sqrt{ux \cdot t_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy 2) < 0.00359999994

    1. Initial program 59.1%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg59.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in59.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
      6. +-commutative58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in59.0%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-59.1%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
    5. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
      2. associate--l+98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      3. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      4. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      5. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      6. distribute-neg-in98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      7. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      8. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-1 \cdot maxCos + \color{blue}{1}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      9. +-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      10. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      11. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      12. unpow298.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      13. *-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
      14. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
      15. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
    8. Step-by-step derivation
      1. associate-*r*96.5%

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

        \[\leadsto \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      3. *-commutative96.5%

        \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      4. +-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
      5. *-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      6. sub-neg96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      7. metadata-eval96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(maxCos + \color{blue}{-1}\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      8. unpow296.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      9. associate-*l*96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      10. distribute-lft-out96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)}} \]
      11. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(maxCos + \color{blue}{\left(-1\right)}\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      12. sub-neg96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\color{blue}{\left(maxCos - 1\right)} \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      13. *-commutative96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} + \left(2 - 2 \cdot maxCos\right)\right)} \]
      14. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)\right)} \]
      15. associate-+r-96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \color{blue}{\left(1 + \left(1 - 2 \cdot maxCos\right)\right)}\right)} \]
    9. Simplified96.4%

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

    if 0.00359999994 < (*.f32 uy 2)

    1. Initial program 57.2%

      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Taylor expanded in ux around 0 46.4%

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
    4. Step-by-step derivation
      1. metadata-eval78.0%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)} \]
      2. associate-+r-78.0%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \color{blue}{\left(1 + \left(1 - 2 \cdot maxCos\right)\right)}} \]
      3. count-278.0%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(1 + \left(1 - \color{blue}{\left(maxCos + maxCos\right)}\right)\right)} \]
      4. associate--l-78.0%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(1 + \color{blue}{\left(\left(1 - maxCos\right) - maxCos\right)}\right)} \]
      5. associate-+r-78.0%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \color{blue}{\left(\left(1 + \left(1 - maxCos\right)\right) - maxCos\right)}} \]
      6. associate-+r-78.1%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(\left(1 + 1\right) - maxCos\right)} - maxCos\right)} \]
      7. metadata-eval78.1%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(\color{blue}{2} - maxCos\right) - maxCos\right)} \]
    5. Simplified78.1%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\ \;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}\\ \end{array} \]

Alternative 11: 95.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.0005000000237487257:\\
\;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy 2) < 5.00000024e-4

    1. Initial program 58.9%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      3. +-commutative58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def58.8%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-58.9%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) - ux \cdot maxCos}, 1\right)} \]
      11. neg-sub058.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
      13. metadata-eval58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-59.0%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
    5. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
      2. associate--l+98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      3. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      4. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      5. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      6. distribute-neg-in98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      7. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      8. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-1 \cdot maxCos + \color{blue}{1}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      9. +-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      10. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      11. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      12. unpow298.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      13. *-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
      14. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
      15. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
    8. Step-by-step derivation
      1. associate-*r*98.2%

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

        \[\leadsto \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      3. *-commutative98.2%

        \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      4. +-commutative98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
      5. *-commutative98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      6. sub-neg98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      7. metadata-eval98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(maxCos + \color{blue}{-1}\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      8. unpow298.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      9. associate-*l*98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      10. distribute-lft-out98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)}} \]
      11. metadata-eval98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(maxCos + \color{blue}{\left(-1\right)}\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      12. sub-neg98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\color{blue}{\left(maxCos - 1\right)} \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      13. *-commutative98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} + \left(2 - 2 \cdot maxCos\right)\right)} \]
      14. metadata-eval98.2%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)\right)} \]
      15. associate-+r-98.2%

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

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

    if 5.00000024e-4 < (*.f32 uy 2)

    1. Initial program 58.1%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      3. +-commutative58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in58.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
      6. +-commutative57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-57.9%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) - ux \cdot maxCos}, 1\right)} \]
      11. neg-sub057.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
      13. metadata-eval57.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-57.9%

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

      \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)}} \]
    4. Taylor expanded in uy around inf 57.8%

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

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}} \]
    6. Step-by-step derivation
      1. *-commutative57.0%

        \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} \]
      2. sub-neg57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(-1\right)\right)}} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      3. metadata-eval57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      4. associate-*r*57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \]
      5. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \]
      6. associate-*r*57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(\pi \cdot 2\right) \cdot uy\right)} \]
      7. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(\color{blue}{\left(2 \cdot \pi\right)} \cdot uy\right) \]
      8. *-commutative57.0%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    7. Simplified57.0%

      \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    8. Taylor expanded in ux around 0 93.9%

      \[\leadsto \sqrt{\color{blue}{-1 \cdot {ux}^{2} + 2 \cdot ux}} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
    9. Step-by-step derivation
      1. +-commutative55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux + -1 \cdot {ux}^{2}}}\right)\right) \]
      2. mul-1-neg55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux + \color{blue}{\left(-{ux}^{2}\right)}}\right)\right) \]
      3. unsub-neg55.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux - {ux}^{2}}}\right)\right) \]
      4. unpow255.0%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right)\right) \]
    10. Simplified93.9%

      \[\leadsto \sqrt{\color{blue}{2 \cdot ux - ux \cdot ux}} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.0005000000237487257:\\ \;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux - ux \cdot ux}\\ \end{array} \]

Alternative 12: 89.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\
\;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy 2) < 0.00359999994

    1. Initial program 59.1%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg59.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in59.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
      6. +-commutative58.9%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in59.0%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-59.0%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-59.1%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
    5. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
      2. associate--l+98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      3. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      4. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      5. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      6. distribute-neg-in98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      7. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      8. metadata-eval98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-1 \cdot maxCos + \color{blue}{1}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      9. +-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      10. mul-1-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      11. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      12. unpow298.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
      13. *-commutative98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
      14. sub-neg98.4%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
      15. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
    8. Step-by-step derivation
      1. associate-*r*96.5%

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

        \[\leadsto \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      3. *-commutative96.5%

        \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
      4. +-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
      5. *-commutative96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      6. sub-neg96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      7. metadata-eval96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(maxCos + \color{blue}{-1}\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      8. unpow296.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      9. associate-*l*96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
      10. distribute-lft-out96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)}} \]
      11. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(maxCos + \color{blue}{\left(-1\right)}\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      12. sub-neg96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\color{blue}{\left(maxCos - 1\right)} \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
      13. *-commutative96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} + \left(2 - 2 \cdot maxCos\right)\right)} \]
      14. metadata-eval96.4%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)\right)} \]
      15. associate-+r-96.5%

        \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \color{blue}{\left(1 + \left(1 - 2 \cdot maxCos\right)\right)}\right)} \]
    9. Simplified96.4%

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

    if 0.00359999994 < (*.f32 uy 2)

    1. Initial program 57.2%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg57.2%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      3. +-commutative57.2%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
      4. distribute-rgt-neg-in57.2%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
      5. fma-def57.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      7. associate-+r-57.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\left(ux \cdot maxCos + 1\right) - ux}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      8. fma-def57.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
      9. distribute-neg-in57.1%

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
      10. unsub-neg57.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
      12. associate--r-57.1%

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
      14. associate-+r-57.1%

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

      \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, -1 + \left(ux - ux \cdot maxCos\right), 1\right)}} \]
    4. Taylor expanded in uy around inf 56.9%

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

      \[\leadsto \color{blue}{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}} \]
    6. Step-by-step derivation
      1. *-commutative55.7%

        \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)} \]
      2. sub-neg55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(-1\right)\right)}} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      3. metadata-eval55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
      4. associate-*r*55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \]
      5. *-commutative55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \]
      6. associate-*r*55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(\left(\pi \cdot 2\right) \cdot uy\right)} \]
      7. *-commutative55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(\color{blue}{\left(2 \cdot \pi\right)} \cdot uy\right) \]
      8. *-commutative55.7%

        \[\leadsto \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    7. Simplified55.7%

      \[\leadsto \color{blue}{\sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right)} \]
    8. Taylor expanded in ux around 0 74.5%

      \[\leadsto \sqrt{\color{blue}{2 \cdot ux}} \cdot \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.003599999938160181:\\ \;\;\;\;\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{2 \cdot ux}\\ \end{array} \]

Alternative 13: 81.3% accurate, 1.5× speedup?

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

\\
\left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}} \]
  5. Step-by-step derivation
    1. fma-def98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)}} \]
    2. associate--l+98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \color{blue}{1 + \left(-1 \cdot \left(maxCos - 1\right) - maxCos\right)}, {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    3. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    4. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    5. metadata-eval98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    6. distribute-neg-in98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    7. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(\color{blue}{-1 \cdot maxCos} + \left(--1\right)\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    8. metadata-eval98.3%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 + -1 \cdot maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    10. mul-1-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 + \color{blue}{\left(-maxCos\right)}\right) - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    11. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\color{blue}{\left(1 - maxCos\right)} - maxCos\right), {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    12. unpow298.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)\right)} \]
    13. *-commutative98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)}\right)} \]
    14. sub-neg98.3%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 1 + \left(\left(1 - maxCos\right) - maxCos\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right)\right)} \]
    15. metadata-eval98.3%

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)}\right)} \]
  8. Step-by-step derivation
    1. associate-*r*83.3%

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

      \[\leadsto \color{blue}{\left(\left(2 \cdot uy\right) \cdot \pi\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
    3. *-commutative83.3%

      \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right)} \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right) + {ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} \]
    4. +-commutative83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
    5. *-commutative83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(\left(maxCos - 1\right) \cdot \left(1 - maxCos\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
    6. sub-neg83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\color{blue}{\left(maxCos + \left(-1\right)\right)} \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
    7. metadata-eval83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left(\left(maxCos + \color{blue}{-1}\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
    8. unpow283.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
    9. associate-*l*83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right)\right)} + ux \cdot \left(2 - 2 \cdot maxCos\right)} \]
    10. distribute-lft-out83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(ux \cdot \left(\left(maxCos + -1\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)}} \]
    11. metadata-eval83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(maxCos + \color{blue}{\left(-1\right)}\right) \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
    12. sub-neg83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\color{blue}{\left(maxCos - 1\right)} \cdot \left(1 - maxCos\right)\right) + \left(2 - 2 \cdot maxCos\right)\right)} \]
    13. *-commutative83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \color{blue}{\left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right)} + \left(2 - 2 \cdot maxCos\right)\right)} \]
    14. metadata-eval83.3%

      \[\leadsto \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\color{blue}{\left(1 + 1\right)} - 2 \cdot maxCos\right)\right)} \]
    15. associate-+r-83.3%

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

    \[\leadsto \color{blue}{\left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(ux \cdot \left(\left(1 - maxCos\right) \cdot \left(maxCos - 1\right)\right) + \left(\left(2 - maxCos\right) - maxCos\right)\right)}} \]
  10. Final simplification83.3%

    \[\leadsto \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(\left(\left(2 - maxCos\right) - maxCos\right) - ux \cdot \left(\left(maxCos + -1\right) \cdot \left(maxCos + -1\right)\right)\right)} \]

Alternative 14: 77.0% accurate, 1.5× speedup?

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

\\
2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - ux \cdot ux}\right)\right)
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

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

    \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \pi\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}\right)} \]
  6. Step-by-step derivation
    1. associate-*l*51.2%

      \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}\right)\right)} \]
    2. sub-neg51.2%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(-1\right)\right)}}\right)\right) \]
    3. metadata-eval51.2%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)}\right)\right) \]
  7. Simplified51.2%

    \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)}\right)\right)} \]
  8. Taylor expanded in ux around 0 78.7%

    \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{-1 \cdot {ux}^{2} + 2 \cdot ux}}\right)\right) \]
  9. Step-by-step derivation
    1. +-commutative78.7%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux + -1 \cdot {ux}^{2}}}\right)\right) \]
    2. mul-1-neg78.7%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux + \color{blue}{\left(-{ux}^{2}\right)}}\right)\right) \]
    3. unsub-neg78.7%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux - {ux}^{2}}}\right)\right) \]
    4. unpow278.7%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right)\right) \]
  10. Simplified78.7%

    \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux - ux \cdot ux}}\right)\right) \]
  11. Final simplification78.7%

    \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - ux \cdot ux}\right)\right) \]

Alternative 15: 63.4% accurate, 1.5× speedup?

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

\\
2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right)
\end{array}
Derivation
  1. Initial program 58.6%

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

      \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. sub-neg58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{1 + \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    3. +-commutative58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right) + 1}} \]
    4. distribute-rgt-neg-in58.6%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(1 - ux\right) + ux \cdot maxCos, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)}} \]
    6. +-commutative58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)} - ux, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    9. distribute-neg-in58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(-\left(1 - ux\right)\right) + \left(-ux \cdot maxCos\right)}, 1\right)} \]
    10. unsub-neg58.5%

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(0 - \left(1 - ux\right)\right)} - ux \cdot maxCos, 1\right)} \]
    12. associate--r-58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{\left(\left(0 - 1\right) + ux\right)} - ux \cdot maxCos, 1\right)} \]
    13. metadata-eval58.5%

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \left(\color{blue}{-1} + ux\right) - ux \cdot maxCos, 1\right)} \]
    14. associate-+r-58.6%

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

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

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

    \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \pi\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}\right)} \]
  6. Step-by-step derivation
    1. associate-*l*51.2%

      \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}\right)\right)} \]
    2. sub-neg51.2%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \color{blue}{\left(ux + \left(-1\right)\right)}}\right)\right) \]
    3. metadata-eval51.2%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + \color{blue}{-1}\right)}\right)\right) \]
  7. Simplified51.2%

    \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux + -1\right)}\right)\right)} \]
  8. Taylor expanded in ux around 0 64.9%

    \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\color{blue}{2 \cdot ux}}\right)\right) \]
  9. Final simplification64.9%

    \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]

Reproduce

?
herbie shell --seed 2023297 
(FPCore (ux uy maxCos)
  :name "UniformSampleCone, y"
  :precision binary32
  :pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0)) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
  (* (sin (* (* uy 2.0) PI)) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))