UniformSampleCone, y

Percentage Accurate: 57.1% → 98.2%
Time: 14.3s
Alternatives: 10
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 57.1% 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.2% accurate, 0.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, 0.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 57.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.99999985e-5 < uy

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right) - maxCos \cdot \left(ux \cdot \color{blue}{\left(2 - 2 \cdot ux\right)}\right)} \]
    6. cancel-sign-sub-inv97.8%

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

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

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

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

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

Alternative 5: 94.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 5.999999848427251 \cdot 10^{-5}:\\ \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\mathsf{fma}\left(maxCos, -2, 2\right) - ux\right)}\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 5.999999848427251e-5)
   (* 2.0 (* uy (* PI (sqrt (* ux (- (fma maxCos -2.0 2.0) ux))))))
   (* (sin (* PI (* uy 2.0))) (sqrt (* ux (- 2.0 ux))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (uy <= 5.999999848427251e-5f) {
		tmp = 2.0f * (uy * (((float) M_PI) * sqrtf((ux * (fmaf(maxCos, -2.0f, 2.0f) - ux)))));
	} 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 (uy <= Float32(5.999999848427251e-5))
		tmp = Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(ux * Float32(fma(maxCos, Float32(-2.0), Float32(2.0)) - ux))))));
	else
		tmp = Float32(sin(Float32(Float32(pi) * Float32(uy * Float32(2.0)))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;uy \leq 5.999999848427251 \cdot 10^{-5}:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\mathsf{fma}\left(maxCos, -2, 2\right) - ux\right)}\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 uy < 5.99999985e-5

    1. Initial program 57.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right) - \color{blue}{ux \cdot ux}}\right)\right) \]
      3. distribute-lft-out--97.3%

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

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

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

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

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

    if 5.99999985e-5 < uy

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 5.999999848427251 \cdot 10^{-5}:\\ \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\mathsf{fma}\left(maxCos, -2, 2\right) - ux\right)}\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 6: 94.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 57.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 + -2 \cdot maxCos\right) - \color{blue}{ux \cdot ux}}\right)\right) \]
      3. distribute-lft-out--97.3%

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

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

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

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

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

    if 5.99999985e-5 < uy

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.001339999958872795:\\ \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\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.001339999958872795)
   (* 2.0 (* uy (* PI (sqrt (* ux (- 2.0 ux))))))
   (* (sin (* uy (* 2.0 PI))) (sqrt (* 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (uy <= 0.001339999958872795f) {
		tmp = 2.0f * (uy * (((float) M_PI) * sqrtf((ux * (2.0f - ux)))));
	} 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.001339999958872795))
		tmp = Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))))));
	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.001339999958872795))
		tmp = single(2.0) * (uy * (single(pi) * sqrt((ux * (single(2.0) - ux)))));
	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.001339999958872795:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\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 < 0.00134

    1. Initial program 58.3%

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

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

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

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

        \[\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. +-commutative58.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(ux \cdot maxCos + \left(1 - ux\right)\right)}} \]
      6. associate-+r-58.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux - \color{blue}{ux \cdot ux}}\right)\right) \]
      3. cancel-sign-sub-inv90.7%

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

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

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

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

    if 0.00134 < uy

    1. Initial program 54.8%

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

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

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

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

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

        \[\leadsto \sin \left(uy \cdot \left(2 \cdot \pi\right)\right) \cdot \sqrt{1 - \left(\mathsf{fma}\left(ux, maxCos, 1\right) - ux\right) \cdot \color{blue}{\left(ux \cdot maxCos + \left(1 - ux\right)\right)}} \]
      6. associate-+r-54.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-def54.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. Simplified54.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 0 44.5%

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

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

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

Alternative 8: 92.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 76.9% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 63.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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