UniformSampleCone, y

Percentage Accurate: 57.5% → 98.4%
Time: 16.7s
Alternatives: 13
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 57.5% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\left(2 - 2 \cdot maxCos\right) \cdot ux + \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)} \]
  8. Step-by-step derivation
    1. add-log-exp61.8%

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

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

    \[\leadsto \sqrt{\left(2 - 2 \cdot maxCos\right) \cdot ux + \left(maxCos - 1\right) \cdot \left(\left(1 - maxCos\right) \cdot {ux}^{2}\right)} \cdot \color{blue}{\log \left(e^{\sin \left(\left(2 \cdot uy\right) \cdot \pi\right)}\right)} \]
  10. Taylor expanded in uy around inf 98.3%

    \[\leadsto \color{blue}{\sqrt{\left(2 - 2 \cdot maxCos\right) \cdot ux + \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)} \]
  11. Step-by-step derivation
    1. *-commutative98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.4% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 3.9999999e-4

    1. Initial program 36.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux, 0 - \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-36.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-36.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-sub036.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. +-commutative36.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-neg36.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-def36.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. Simplified36.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 91.9%

      \[\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)}} \]
    5. Step-by-step derivation
      1. associate--l+91.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9999999e-4 < ux

    1. Initial program 91.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*91.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-neg91.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. +-commutative91.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-in91.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-def91.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. +-commutative91.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-91.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. flip-+77.2%

        \[\leadsto 2 \cdot \left(\sqrt{\color{blue}{\frac{1 \cdot 1 - \left(\left(ux - \left(1 + maxCos \cdot ux\right)\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)\right) \cdot \left(\left(ux - \left(1 + maxCos \cdot ux\right)\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)\right)}{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) \]
    6. Applied egg-rr77.5%

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

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

Alternative 5: 92.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\left(2 - 2 \cdot maxCos\right) \cdot ux + \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)} \]
  8. Step-by-step derivation
    1. add-log-exp61.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.4% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 7.9999998e-5

    1. Initial program 33.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*33.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-neg33.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. +-commutative33.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-in33.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-def33.0%

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

        \[\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-33.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-def33.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-sub033.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. +-commutative33.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-33.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-33.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-sub033.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. +-commutative33.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-neg33.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-def33.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. Simplified33.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 93.6%

      \[\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)}} \]
    5. Step-by-step derivation
      1. associate--l+93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.9999998e-5 < ux

    1. Initial program 89.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*89.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-neg89.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. +-commutative89.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-in89.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-def89.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. +-commutative89.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-89.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. flip-+75.0%

        \[\leadsto 2 \cdot \left(\sqrt{\color{blue}{\frac{1 \cdot 1 - \left(\left(ux - \left(1 + maxCos \cdot ux\right)\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)\right) \cdot \left(\left(ux - \left(1 + maxCos \cdot ux\right)\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)\right)}{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) \]
    6. Applied egg-rr75.2%

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

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

Alternative 7: 76.4% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 9.99999975e-5

    1. Initial program 33.3%

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

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

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

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

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

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

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

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

        \[\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-sub033.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative33.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-33.3%

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

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

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

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

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

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

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

      \[\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)}} \]
    5. Step-by-step derivation
      1. associate--l+93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999975e-5 < ux

    1. Initial program 89.3%

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

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

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

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

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

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

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

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

        \[\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-sub089.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative89.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-89.3%

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

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

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

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

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

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

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

      \[\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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.1%

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

Alternative 8: 76.5% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 9.99999975e-5

    1. Initial program 33.3%

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

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

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

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

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

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

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

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

        \[\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-sub033.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative33.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-33.3%

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

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

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

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

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

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

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

      \[\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)}} \]
    5. Step-by-step derivation
      1. associate--l+93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999975e-5 < ux

    1. Initial program 89.3%

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

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

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

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

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

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

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

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

        \[\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-sub089.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative89.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-89.3%

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. *-un-lft-identity75.1%

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

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

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

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

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

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

Alternative 9: 75.2% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 9.99999975e-5

    1. Initial program 33.3%

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

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

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

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

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

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

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

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

        \[\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-sub033.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative33.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-33.3%

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

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

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

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

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

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

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

      \[\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)}} \]
    5. Step-by-step derivation
      1. associate--l+93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999975e-5 < ux

    1. Initial program 89.3%

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

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

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

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

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

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

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

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

        \[\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-sub089.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}{0 - \left(\left(1 - ux\right) + ux \cdot maxCos\right)}, 1\right)} \]
      10. +-commutative89.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(ux \cdot maxCos + \left(1 - ux\right)\right)}, 1\right)} \]
      11. associate-+r-89.3%

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

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

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

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

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

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

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

      \[\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 maxCos around 0 71.9%

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

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

Alternative 10: 66.0% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

    \[\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)}} \]
  5. Step-by-step derivation
    1. associate--l+76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 66.0% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

    \[\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)}} \]
  5. Step-by-step derivation
    1. associate--l+76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 63.4% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

    \[\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)}} \]
  5. Step-by-step derivation
    1. associate--l+76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 7.1% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(\color{blue}{ux \cdot maxCos + \left(1 - ux\right)}, -\left(\left(1 - ux\right) + ux \cdot maxCos\right), 1\right)} \]
    7. associate-+r-55.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-def55.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-sub055.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. +-commutative55.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-55.6%

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

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

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

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

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

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

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

    \[\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 2023255 
(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)))))))