UniformSampleCone, y

Percentage Accurate: 58.5% → 98.3%
Time: 17.5s
Alternatives: 9
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 9 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: 58.5% 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.3× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\\
t_1 := \mathsf{fma}\left(ux, \mathsf{fma}\left(-2, maxCos, 1\right), ux\right) - \left(maxCos + -1\right) \cdot \left(\left(maxCos + -1\right) \cdot \left(ux \cdot ux\right)\right)\\
\sqrt[3]{\left(t_0 \cdot \sqrt{t_1}\right) \cdot \left(t_1 \cdot \left(t_0 \cdot t_0\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 53.9%

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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.3%

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

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

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

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

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

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

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

      \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
    8. sub-neg98.3%

      \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
    9. metadata-eval98.3%

      \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
  6. Simplified98.3%

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

      \[\leadsto \color{blue}{e^{\log \left(\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 \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}\right)}} \]
    2. distribute-rgt-in90.3%

      \[\leadsto e^{\log \left(\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}{1 \cdot ux + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux}\right)}\right)} \]
    3. *-un-lft-identity90.3%

      \[\leadsto e^{\log \left(\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} + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux\right)}\right)} \]
    4. distribute-neg-in90.3%

      \[\leadsto e^{\log \left(\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 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right) \cdot ux\right)}\right)} \]
    5. metadata-eval90.3%

      \[\leadsto e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + \color{blue}{1}\right) - maxCos\right) \cdot ux\right)}\right)} \]
  8. Applied egg-rr90.3%

    \[\leadsto \color{blue}{e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + 1\right) - maxCos\right) \cdot ux\right)}\right)}} \]
  9. Taylor expanded in uy around inf 98.3%

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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.3%

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

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

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

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

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

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

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

      \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
    8. sub-neg98.3%

      \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
    9. metadata-eval98.3%

      \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
  6. Simplified98.3%

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

      \[\leadsto \color{blue}{e^{\log \left(\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 \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}\right)}} \]
    2. distribute-rgt-in90.3%

      \[\leadsto e^{\log \left(\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}{1 \cdot ux + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux}\right)}\right)} \]
    3. *-un-lft-identity90.3%

      \[\leadsto e^{\log \left(\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} + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux\right)}\right)} \]
    4. distribute-neg-in90.3%

      \[\leadsto e^{\log \left(\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 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right) \cdot ux\right)}\right)} \]
    5. metadata-eval90.3%

      \[\leadsto e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + \color{blue}{1}\right) - maxCos\right) \cdot ux\right)}\right)} \]
  8. Applied egg-rr90.3%

    \[\leadsto \color{blue}{e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + 1\right) - maxCos\right) \cdot ux\right)}\right)}} \]
  9. Taylor expanded in uy around inf 98.3%

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

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

Alternative 3: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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.3%

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

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

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

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

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

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

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

      \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
    8. sub-neg98.3%

      \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
    9. metadata-eval98.3%

      \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
  6. Simplified98.3%

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

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

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

Alternative 4: 97.6% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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 51.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.5%

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

      \[\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 + -1 \cdot {ux}^{2}\right)}} \]
    2. neg-mul-197.5%

      \[\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}{\left(-{ux}^{2}\right)}\right)} \]
    3. unsub-neg97.5%

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

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

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

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

Alternative 5: 95.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 54.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*54.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. sub-neg54.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. mul-1-neg98.2%

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

        \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
      9. metadata-eval98.2%

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

      \[\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 \cdot \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}} \]
    7. Taylor expanded in maxCos around 0 98.1%

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

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

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

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

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

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

    if 1.50000005e-6 < maxCos

    1. Initial program 51.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*51.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. sub-neg51.5%

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

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

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

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

        \[\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-51.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-def51.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-sub051.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. +-commutative51.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-50.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
      8. sub-neg98.9%

        \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
      9. metadata-eval98.9%

        \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
    6. Simplified98.9%

      \[\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 \cdot \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}} \]
    7. Step-by-step derivation
      1. add-exp-log91.5%

        \[\leadsto \color{blue}{e^{\log \left(\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 \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}\right)}} \]
      2. distribute-rgt-in91.5%

        \[\leadsto e^{\log \left(\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}{1 \cdot ux + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux}\right)}\right)} \]
      3. *-un-lft-identity91.5%

        \[\leadsto e^{\log \left(\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} + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux\right)}\right)} \]
      4. distribute-neg-in91.5%

        \[\leadsto e^{\log \left(\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 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right) \cdot ux\right)}\right)} \]
      5. metadata-eval91.5%

        \[\leadsto e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + \color{blue}{1}\right) - maxCos\right) \cdot ux\right)}\right)} \]
    8. Applied egg-rr91.5%

      \[\leadsto \color{blue}{e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + 1\right) - maxCos\right) \cdot ux\right)}\right)}} \]
    9. Taylor expanded in uy around 0 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 81.7% accurate, 1.4× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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.3%

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

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

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

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

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

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

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

      \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
    8. sub-neg98.3%

      \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
    9. metadata-eval98.3%

      \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
  6. Simplified98.3%

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

      \[\leadsto \color{blue}{e^{\log \left(\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 \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}\right)}} \]
    2. distribute-rgt-in90.3%

      \[\leadsto e^{\log \left(\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}{1 \cdot ux + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux}\right)}\right)} \]
    3. *-un-lft-identity90.3%

      \[\leadsto e^{\log \left(\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} + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux\right)}\right)} \]
    4. distribute-neg-in90.3%

      \[\leadsto e^{\log \left(\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 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right) \cdot ux\right)}\right)} \]
    5. metadata-eval90.3%

      \[\leadsto e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + \color{blue}{1}\right) - maxCos\right) \cdot ux\right)}\right)} \]
  8. Applied egg-rr90.3%

    \[\leadsto \color{blue}{e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + 1\right) - maxCos\right) \cdot ux\right)}\right)}} \]
  9. Taylor expanded in uy around 0 81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 66.1% accurate, 1.5× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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 51.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 uy around 0 45.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 77.5% accurate, 1.5× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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.3%

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

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

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

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

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

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

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

      \[\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 \left(1 + \left(\color{blue}{\left(-\left(maxCos - 1\right)\right)} - maxCos\right)\right)\right)} \]
    8. sub-neg98.3%

      \[\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 \left(1 + \left(\left(-\color{blue}{\left(maxCos + \left(-1\right)\right)}\right) - maxCos\right)\right)\right)} \]
    9. metadata-eval98.3%

      \[\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 \left(1 + \left(\left(-\left(maxCos + \color{blue}{-1}\right)\right) - maxCos\right)\right)\right)} \]
  6. Simplified98.3%

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

      \[\leadsto \color{blue}{e^{\log \left(\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 \left(1 + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right)\right)\right)}\right)}} \]
    2. distribute-rgt-in90.3%

      \[\leadsto e^{\log \left(\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}{1 \cdot ux + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux}\right)}\right)} \]
    3. *-un-lft-identity90.3%

      \[\leadsto e^{\log \left(\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} + \left(\left(-\left(maxCos + -1\right)\right) - maxCos\right) \cdot ux\right)}\right)} \]
    4. distribute-neg-in90.3%

      \[\leadsto e^{\log \left(\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 + \left(\color{blue}{\left(\left(-maxCos\right) + \left(--1\right)\right)} - maxCos\right) \cdot ux\right)}\right)} \]
    5. metadata-eval90.3%

      \[\leadsto e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + \color{blue}{1}\right) - maxCos\right) \cdot ux\right)}\right)} \]
  8. Applied egg-rr90.3%

    \[\leadsto \color{blue}{e^{\log \left(\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 + \left(\left(\left(-maxCos\right) + 1\right) - maxCos\right) \cdot ux\right)}\right)}} \]
  9. Taylor expanded in uy around 0 81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 63.4% accurate, 1.5× speedup?

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(-\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)} + 1} \]
    5. fma-def54.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. +-commutative54.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-54.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-def54.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-sub054.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. +-commutative54.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-53.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-53.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-sub053.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. +-commutative53.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-neg53.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-def53.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. Simplified53.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 51.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 uy around 0 45.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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