UniformSampleCone, y

Percentage Accurate: 57.9% → 98.3%
Time: 19.6s
Alternatives: 13
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 13 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.9% 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.5× speedup?

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

\\
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{{\left(ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}\right)}^{1.5}}
\end{array}
Derivation
  1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot {ux}^{2}}\right)} \]
    12. distribute-rgt-neg-in98.5%

      \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot \left(-{ux}^{2}\right)}\right)} \]
    13. mul-1-neg98.5%

      \[\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(1 + \color{blue}{\left(-maxCos\right)}\right)}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
    14. sub-neg98.5%

      \[\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(1 - maxCos\right)}}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
    15. unpow298.5%

      \[\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(1 - maxCos\right)}^{2} \cdot \left(-\color{blue}{ux \cdot ux}\right)\right)} \]
    16. distribute-rgt-neg-in98.5%

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

    \[\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(1 - maxCos\right)}^{2} \cdot \left(ux \cdot \left(-ux\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. add-cbrt-cube98.4%

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.5× speedup?

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

\\
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{{\left(ux \cdot \left(\mathsf{fma}\left(-2, maxCos, 2\right) - ux \cdot {\left(1 - maxCos\right)}^{2}\right)\right)}^{1.5}}
\end{array}
Derivation
  1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot {ux}^{2}}\right)} \]
    12. distribute-rgt-neg-in98.5%

      \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot \left(-{ux}^{2}\right)}\right)} \]
    13. mul-1-neg98.5%

      \[\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(1 + \color{blue}{\left(-maxCos\right)}\right)}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
    14. sub-neg98.5%

      \[\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(1 - maxCos\right)}}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
    15. unpow298.5%

      \[\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(1 - maxCos\right)}^{2} \cdot \left(-\color{blue}{ux \cdot ux}\right)\right)} \]
    16. distribute-rgt-neg-in98.5%

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

    \[\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(1 - maxCos\right)}^{2} \cdot \left(ux \cdot \left(-ux\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. add-cbrt-cube98.4%

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

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

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

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

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

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \color{blue}{\sqrt[3]{{\left(ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}\right)}^{1.5}}} \]
  11. Step-by-step derivation
    1. *-un-lft-identity98.5%

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

    \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt[3]{\color{blue}{1 \cdot {\left(ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right) - \left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2}\right)}^{1.5}}} \]
  13. Step-by-step derivation
    1. *-lft-identity98.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 0.8× speedup?

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

\\
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos + -1, \left(ux \cdot ux\right) \cdot \left(1 - maxCos\right), ux - ux \cdot \left(maxCos + \left(maxCos + -1\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 58.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*58.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. sub-neg58.8%

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

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

      \[\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-def59.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. +-commutative59.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-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. 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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
    10. +-commutative59.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, 0 - \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
    11. 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, 0 - \color{blue}{\left(\left(ux \cdot maxCos + 1\right) - ux\right)}, 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(0 - \left(ux \cdot maxCos + 1\right)\right) + ux}, 1\right)} \]
    13. 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(-\left(ux \cdot maxCos + 1\right)\right)} + ux, 1\right)} \]
    14. +-commutative58.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}{ux + \left(-\left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]
    15. sub-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}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def58.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified58.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, ux - \mathsf{fma}\left(ux, maxCos, 1\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}{\left(maxCos - 1\right) \cdot \left(\left(1 - maxCos\right) \cdot {ux}^{2}\right) + ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\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(maxCos - 1, \left(1 - maxCos\right) \cdot {ux}^{2}, ux \cdot \left(\left(1 + -1 \cdot \left(maxCos - 1\right)\right) - maxCos\right)\right)}} \]
    2. sub-neg98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.0× speedup?

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

\\
\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(\left(2 \cdot ux - \left(ux \cdot maxCos\right) \cdot \left(ux \cdot maxCos\right)\right) + maxCos \cdot \left(-2 \cdot \left(ux \cdot \left(1 - ux\right)\right)\right)\right) - ux \cdot ux}
\end{array}
Derivation
  1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 98.3% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(\left(2 \cdot ux - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) + maxCos \cdot \left(2 \cdot \left(ux \cdot ux - ux\right)\right)\right) - ux \cdot ux} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (*
      (sin (* uy (* 2.0 PI)))
      (sqrt
       (-
        (+
         (- (* 2.0 ux) (* (* ux ux) (* maxCos maxCos)))
         (* maxCos (* 2.0 (- (* ux ux) ux))))
        (* ux ux)))))
    float code(float ux, float uy, float maxCos) {
    	return sinf((uy * (2.0f * ((float) M_PI)))) * sqrtf(((((2.0f * ux) - ((ux * ux) * (maxCos * maxCos))) + (maxCos * (2.0f * ((ux * ux) - ux)))) - (ux * ux)));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sin(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(Float32(Float32(Float32(Float32(2.0) * ux) - Float32(Float32(ux * ux) * Float32(maxCos * maxCos))) + Float32(maxCos * Float32(Float32(2.0) * Float32(Float32(ux * ux) - ux)))) - Float32(ux * ux))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = sin((uy * (single(2.0) * single(pi)))) * sqrt(((((single(2.0) * ux) - ((ux * ux) * (maxCos * maxCos))) + (maxCos * (single(2.0) * ((ux * ux) - ux)))) - (ux * ux)));
    end
    
    \begin{array}{l}
    
    \\
    \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(\left(2 \cdot ux - \left(ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)\right) + maxCos \cdot \left(2 \cdot \left(ux \cdot ux - ux\right)\right)\right) - ux \cdot ux}
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \color{blue}{\left(1 + \left(\left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2} - \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)\right)}} \]
    7. Step-by-step derivation
      1. add-exp-log62.0%

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{e^{\log \left(0 - \left(\color{blue}{{\left(1 - maxCos\right)}^{2} \cdot \left(ux \cdot ux\right)} - \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)\right)}} \]
    8. Applied egg-rr96.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(\left(ux \cdot 2 - \left(ux \cdot ux\right) \cdot \color{blue}{\left(maxCos \cdot maxCos\right)}\right) - maxCos \cdot \left(2 \cdot ux - 2 \cdot {ux}^{2}\right)\right) - {ux}^{2}} \]
      10. distribute-lft-out--98.5%

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

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

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

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

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

    Alternative 6: 97.7% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot \left(1 - ux\right)\\ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(2 \cdot ux - ux \cdot ux\right) - maxCos \cdot \left(t_0 + t_0\right)} \end{array} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (let* ((t_0 (* ux (- 1.0 ux))))
       (*
        (sin (* uy (* 2.0 PI)))
        (sqrt (- (- (* 2.0 ux) (* ux ux)) (* maxCos (+ t_0 t_0)))))))
    float code(float ux, float uy, float maxCos) {
    	float t_0 = ux * (1.0f - ux);
    	return sinf((uy * (2.0f * ((float) M_PI)))) * sqrtf((((2.0f * ux) - (ux * ux)) - (maxCos * (t_0 + t_0))));
    }
    
    function code(ux, uy, maxCos)
    	t_0 = Float32(ux * Float32(Float32(1.0) - ux))
    	return Float32(sin(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(Float32(Float32(Float32(2.0) * ux) - Float32(ux * ux)) - Float32(maxCos * Float32(t_0 + t_0)))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	t_0 = ux * (single(1.0) - ux);
    	tmp = sin((uy * (single(2.0) * single(pi)))) * sqrt((((single(2.0) * ux) - (ux * ux)) - (maxCos * (t_0 + t_0))));
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := ux \cdot \left(1 - ux\right)\\
    \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\left(2 \cdot ux - ux \cdot ux\right) - maxCos \cdot \left(t_0 + t_0\right)}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. sub-neg58.8%

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

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

        \[\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-def59.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. +-commutative59.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-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. 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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative59.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, 0 - \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. 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, 0 - \color{blue}{\left(\left(ux \cdot maxCos + 1\right) - ux\right)}, 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(0 - \left(ux \cdot maxCos + 1\right)\right) + ux}, 1\right)} \]
      13. 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(-\left(ux \cdot maxCos + 1\right)\right)} + ux, 1\right)} \]
      14. +-commutative58.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}{ux + \left(-\left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]
      15. sub-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}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
      16. fma-def58.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
    3. Simplified58.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, ux - \mathsf{fma}\left(ux, maxCos, 1\right), 1\right)}} \]
    4. Taylor expanded in maxCos around 0 57.5%

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

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

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

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

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

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

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

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

    Alternative 7: 97.7% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right) - maxCos \cdot \left(-2 \cdot \left(ux \cdot ux - ux\right)\right)} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (*
      (sin (* uy (* 2.0 PI)))
      (sqrt (- (* ux (- 2.0 ux)) (* maxCos (* -2.0 (- (* ux ux) ux)))))))
    float code(float ux, float uy, float maxCos) {
    	return sinf((uy * (2.0f * ((float) M_PI)))) * sqrtf(((ux * (2.0f - ux)) - (maxCos * (-2.0f * ((ux * ux) - ux)))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sin(Float32(uy * Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(Float32(ux * Float32(Float32(2.0) - ux)) - Float32(maxCos * Float32(Float32(-2.0) * Float32(Float32(ux * ux) - ux))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = sin((uy * (single(2.0) * single(pi)))) * sqrt(((ux * (single(2.0) - ux)) - (maxCos * (single(-2.0) * ((ux * ux) - ux)))));
    end
    
    \begin{array}{l}
    
    \\
    \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right) - maxCos \cdot \left(-2 \cdot \left(ux \cdot ux - ux\right)\right)}
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \color{blue}{\left(1 + \left(\left(ux \cdot ux\right) \cdot {\left(1 - maxCos\right)}^{2} - \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)\right)}} \]
    7. Step-by-step derivation
      1. add-exp-log62.0%

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{e^{\log \left(0 - \left(\color{blue}{{\left(1 - maxCos\right)}^{2} \cdot \left(ux \cdot ux\right)} - \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)\right)}} \]
    8. Applied egg-rr96.7%

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{maxCos \cdot \left(-2 \cdot ux - -2 \cdot {ux}^{2}\right)} + \left(2 \cdot ux - {ux}^{2}\right)} \]
      3. distribute-lft-out--97.9%

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

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

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

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

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

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

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

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

    Alternative 8: 85.5% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.003000000026077032:\\ \;\;\;\;2 \cdot \left(\sqrt{ux \cdot \left(2 - ux\right)} \cdot \left(uy \cdot \pi\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 0.003000000026077032)
       (* 2.0 (* (sqrt (* ux (- 2.0 ux))) (* uy PI)))
       (* (sin (* uy (* 2.0 PI))) (sqrt (* 2.0 ux)))))
    float code(float ux, float uy, float maxCos) {
    	float tmp;
    	if (uy <= 0.003000000026077032f) {
    		tmp = 2.0f * (sqrtf((ux * (2.0f - ux))) * (uy * ((float) M_PI)));
    	} 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 (uy <= Float32(0.003000000026077032))
    		tmp = Float32(Float32(2.0) * Float32(sqrt(Float32(ux * Float32(Float32(2.0) - ux))) * Float32(uy * Float32(pi))));
    	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(0.003000000026077032))
    		tmp = single(2.0) * (sqrt((ux * (single(2.0) - ux))) * (uy * single(pi)));
    	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 \leq 0.003000000026077032:\\
    \;\;\;\;2 \cdot \left(\sqrt{ux \cdot \left(2 - ux\right)} \cdot \left(uy \cdot \pi\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 uy < 0.00300000003

      1. Initial program 58.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right) \]
        3. distribute-rgt-out--91.5%

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

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

      if 0.00300000003 < uy

      1. Initial program 60.5%

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

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

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

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

          \[\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. +-commutative60.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(ux \cdot maxCos + \left(1 - ux\right)\right)}} \]
        6. associate-+r-60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 92.3% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (* (sin (* PI (* uy 2.0))) (sqrt (* ux (- 2.0 ux)))))
    float code(float ux, float uy, float maxCos) {
    	return sinf((((float) M_PI) * (uy * 2.0f))) * sqrtf((ux * (2.0f - ux)));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sin(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = sin((single(pi) * (uy * single(2.0)))) * sqrt((ux * (single(2.0) - ux)));
    end
    
    \begin{array}{l}
    
    \\
    \sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot {ux}^{2}}\right)} \]
      12. distribute-rgt-neg-in98.5%

        \[\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(1 + -1 \cdot maxCos\right)}^{2} \cdot \left(-{ux}^{2}\right)}\right)} \]
      13. mul-1-neg98.5%

        \[\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(1 + \color{blue}{\left(-maxCos\right)}\right)}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
      14. sub-neg98.5%

        \[\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(1 - maxCos\right)}}^{2} \cdot \left(-{ux}^{2}\right)\right)} \]
      15. unpow298.5%

        \[\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(1 - maxCos\right)}^{2} \cdot \left(-\color{blue}{ux \cdot ux}\right)\right)} \]
      16. distribute-rgt-neg-in98.5%

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

      \[\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(1 - maxCos\right)}^{2} \cdot \left(ux \cdot \left(-ux\right)\right)\right)}} \]
    7. Step-by-step derivation
      1. add-cbrt-cube98.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}} \]
      4. distribute-rgt-out--93.5%

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

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

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

    Alternative 10: 77.1% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)\right) \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (* 2.0 (* uy (* PI (sqrt (* ux (- 2.0 ux)))))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (uy * (((float) M_PI) * sqrtf((ux * (2.0f - ux)))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (uy * (single(pi) * sqrt((ux * (single(2.0) - ux)))));
    end
    
    \begin{array}{l}
    
    \\
    2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right) \]
      3. distribute-rgt-out--79.4%

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

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

        \[\leadsto 2 \cdot \color{blue}{{\left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)}^{1}} \]
    14. Applied egg-rr79.4%

      \[\leadsto 2 \cdot \color{blue}{{\left(\left(uy \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)}^{1}} \]
    15. Step-by-step derivation
      1. unpow179.4%

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

        \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)\right)} \]
    16. Simplified79.3%

      \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)\right)} \]
    17. Final simplification79.3%

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

    Alternative 11: 77.1% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ 2 \cdot \left(\sqrt{ux \cdot \left(2 - ux\right)} \cdot \left(uy \cdot \pi\right)\right) \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (* 2.0 (* (sqrt (* ux (- 2.0 ux))) (* uy PI))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (sqrtf((ux * (2.0f - ux))) * (uy * ((float) M_PI)));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(sqrt(Float32(ux * Float32(Float32(2.0) - ux))) * Float32(uy * Float32(pi))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (sqrt((ux * (single(2.0) - ux))) * (uy * single(pi)));
    end
    
    \begin{array}{l}
    
    \\
    2 \cdot \left(\sqrt{ux \cdot \left(2 - ux\right)} \cdot \left(uy \cdot \pi\right)\right)
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right) \]
      3. distribute-rgt-out--79.4%

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

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

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

    Alternative 12: 63.2% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux}\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(Float32(uy * 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(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux}\right)
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. +-commutative58.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-58.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-def58.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. +-commutative58.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-58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right) \]
      3. distribute-rgt-out--79.4%

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

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

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

        \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot 2}}\right) \]
    15. Simplified65.0%

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

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

    Alternative 13: 7.1% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{0}\right) \end{array} \]
    (FPCore (ux uy maxCos) :precision binary32 (* 2.0 (* (* uy PI) (sqrt 0.0))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * ((uy * ((float) M_PI)) * sqrtf(0.0f));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(Float32(uy * Float32(pi)) * sqrt(Float32(0.0))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * ((uy * single(pi)) * sqrt(single(0.0)));
    end
    
    \begin{array}{l}
    
    \\
    2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{0}\right)
    \end{array}
    
    Derivation
    1. Initial program 58.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*58.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. sub-neg58.8%

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

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

        \[\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-def59.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. +-commutative59.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-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. 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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative59.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, 0 - \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. 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, 0 - \color{blue}{\left(\left(ux \cdot maxCos + 1\right) - ux\right)}, 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(0 - \left(ux \cdot maxCos + 1\right)\right) + ux}, 1\right)} \]
      13. 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(-\left(ux \cdot maxCos + 1\right)\right)} + ux, 1\right)} \]
      14. +-commutative58.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}{ux + \left(-\left(ux \cdot maxCos + 1\right)\right)}, 1\right)} \]
      15. sub-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}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
      16. fma-def58.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
    3. Simplified58.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, ux - \mathsf{fma}\left(ux, maxCos, 1\right), 1\right)}} \]
    4. Taylor expanded in uy around 0 51.8%

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

      \[\leadsto 2 \cdot \left(\sqrt{1 + \color{blue}{-1}} \cdot \left(uy \cdot \pi\right)\right) \]
    6. Final simplification7.1%

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

    Reproduce

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