UniformSampleCone, y

Percentage Accurate: 57.3% → 98.3%
Time: 22.5s
Alternatives: 8
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 8 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.3% accurate, 0.4× speedup?

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

\\
\sin \left(\sqrt[3]{{\left(uy \cdot 2\right)}^{3} \cdot {\pi}^{3}}\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}
\end{array}
Derivation
  1. Initial program 52.8%

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}} \]
  7. Step-by-step derivation
    1. associate-*r*98.4%

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.8× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}} \]
  7. Step-by-step derivation
    1. associate-*r*98.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.6% accurate, 1.0× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}} \]
  7. Step-by-step derivation
    1. associate-*r*98.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;maxCos \leq 3.999999989900971 \cdot 10^{-6}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if maxCos < 3.99999999e-6

    1. Initial program 53.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*53.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. +-commutative53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999e-6 < maxCos

    1. Initial program 47.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*47.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. +-commutative47.2%

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

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

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

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

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

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

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

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

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

Alternative 5: 92.1% accurate, 1.0× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, -2, 2\right), ux, \left(ux \cdot ux\right) \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}} \]
  7. Step-by-step derivation
    1. associate-*r*98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 77.1% accurate, 1.5× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto uy \cdot \left(\left(\pi \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - 2 \cdot maxCos\right) + ux \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}}\right) \cdot 2\right) \]
    10. cancel-sign-sub-inv78.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto uy \cdot \left(\color{blue}{\left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)} \cdot 2\right) \]
  13. Final simplification74.4%

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

Alternative 7: 77.1% accurate, 1.5× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto uy \cdot \left(\left(\pi \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 - 2 \cdot maxCos\right) + ux \cdot \left(-{\left(1 - maxCos\right)}^{2}\right)\right)}}\right) \cdot 2\right) \]
    10. cancel-sign-sub-inv78.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(2 \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right) \cdot \left(uy \cdot \pi\right)} \]
  13. Final simplification74.4%

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

Alternative 8: 63.4% accurate, 1.5× speedup?

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

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

    \[\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*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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