UniformSampleCone, y

Percentage Accurate: 57.8% → 98.4%
Time: 17.5s
Alternatives: 13
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 57.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 0.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.6% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(maxCos, -2 \cdot ux - -2 \cdot {ux}^{2}, 2 \cdot ux - {ux}^{2}\right)}} \]
    4. distribute-lft-out--97.1%

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

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

      \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos, -2 \cdot \left(ux - ux \cdot ux\right), 2 \cdot ux - \color{blue}{ux \cdot ux}\right)} \]
    7. distribute-rgt-out--97.1%

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

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

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

Alternative 6: 95.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(uy \cdot 2\right)\\
\mathbf{if}\;uy \cdot 2 \leq 0.0002099999983329326:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(maxCos + -1, \left(1 - maxCos\right) \cdot \left(ux \cdot ux\right), ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)\right)} \cdot t_0\\

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.09999998e-4 < (*.f32 uy 2)

    1. Initial program 50.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*50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.09999998e-4 < (*.f32 uy 2)

    1. Initial program 50.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*50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 89.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 57.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*57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000024e-4 < uy

    1. Initial program 50.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 81.7% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 80.6% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.8% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

    \[\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-+r-50.1%

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

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

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

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

Alternative 12: 77.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 7.1% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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