UniformSampleCone, y

Percentage Accurate: 57.3% → 98.3%
Time: 30.8s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 57.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\color{blue}{\left(ux \cdot ux\right)} \cdot \left(1 - 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(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. pow198.2%

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\color{blue}{\left(ux \cdot ux\right)} \cdot \left(1 - 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(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. pow198.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 60.5%

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

        \[\leadsto \sin \color{blue}{\left(uy \cdot \left(2 \cdot \pi\right)\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. sub-neg60.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. +-commutative60.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-in60.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-def60.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.00760000013 < (*.f32 uy 2)

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 92.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\color{blue}{\left(ux \cdot ux\right)} \cdot \left(1 - 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(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. pow198.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 81.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

    \[\leadsto \color{blue}{\sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\color{blue}{\left(ux \cdot ux\right)} \cdot \left(1 - 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(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\left(ux \cdot ux\right) \cdot \left(1 - maxCos\right)\right)\right)}} \]
  7. Step-by-step derivation
    1. pow198.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 77.2% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \pi\right) \cdot \sqrt{-1 \cdot {ux}^{2} + 2 \cdot ux}\right)} \]
  9. Step-by-step derivation
    1. +-commutative78.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-neg78.5%

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

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

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

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

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

Alternative 8: 77.2% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \pi\right) \cdot \sqrt{-1 \cdot {ux}^{2} + 2 \cdot ux}\right)} \]
  9. Step-by-step derivation
    1. +-commutative78.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-neg78.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 77.2% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \left(\sqrt{\color{blue}{\mathsf{fma}\left(ux, \left(1 - maxCos\right) + \left(1 - maxCos\right), \left(maxCos + -1\right) \cdot \left(\left(\left(1 - maxCos\right) \cdot ux\right) \cdot ux\right)\right)}} \cdot \left(uy \cdot \pi\right)\right) \]
  8. Step-by-step derivation
    1. expm1-log1p-u81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 7.1% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, \color{blue}{ux - \left(ux \cdot maxCos + 1\right)}, 1\right)} \]
    16. fma-def59.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, ux - \color{blue}{\mathsf{fma}\left(ux, maxCos, 1\right)}, 1\right)} \]
  3. Simplified59.0%

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

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

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

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

Reproduce

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