UniformSampleCone, y

Percentage Accurate: 57.2% → 98.3%
Time: 22.3s
Alternatives: 12
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 12 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.2% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 96.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999987e-6 < maxCos

    1. Initial program 51.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999987e-6 < maxCos

    1. Initial program 51.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 92.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 77.5% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 77.5% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 63.7% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 7.1% accurate, 322.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (ux uy maxCos) :precision binary32 0.0)
float code(float ux, float uy, float maxCos) {
	return 0.0f;
}
real(4) function code(ux, uy, maxcos)
    real(4), intent (in) :: ux
    real(4), intent (in) :: uy
    real(4), intent (in) :: maxcos
    code = 0.0e0
end function
function code(ux, uy, maxCos)
	return Float32(0.0)
end
function tmp = code(ux, uy, maxCos)
	tmp = single(0.0);
end
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 54.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0} \]
  10. Final simplification7.1%

    \[\leadsto 0 \]

Reproduce

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