UniformSampleCone, y

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

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

Initial Program: 57.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.4× speedup?

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

\\
\sin \left(\sqrt[3]{{\left(uy \cdot 2\right)}^{3} \cdot {\pi}^{3}}\right) \cdot \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), {\left(1 - maxCos\right)}^{2} \cdot \left(ux \cdot \left(-ux\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.6× speedup?

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

\\
\sqrt{ux \cdot \left(\mathsf{fma}\left(maxCos, -2, 2\right) - ux \cdot {\left(1 - maxCos\right)}^{2}\right)} \cdot \sin \left(\pi \cdot \left(uy \cdot 2\right)\right)
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := 2 \cdot ux - ux \cdot ux\\
\sin \left(\pi \cdot \left(uy \cdot 2\right)\right) \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{t_0}} \cdot \left(maxCos \cdot \left(-2 \cdot \left(ux - ux \cdot ux\right)\right)\right)\right) + \sqrt{t_0}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(0.5 \cdot \left(\sqrt{\frac{1}{2 \cdot ux - ux \cdot ux}} \cdot \left(maxCos \cdot \left(-2 \cdot \left(ux - ux \cdot ux\right)\right)\right)\right) + \sqrt{2 \cdot ux - ux \cdot ux}\right)} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \]
  15. Final simplification96.0%

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

Alternative 4: 95.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 53.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*53.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. +-commutative53.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-53.9%

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

        \[\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. +-commutative53.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(ux \cdot maxCos + \left(1 - ux\right)\right)}} \]
      6. associate-+r-53.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-def53.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. Simplified53.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 -inf 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999e-6 < maxCos

    1. Initial program 47.2%

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

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

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

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

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

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

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

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

Alternative 5: 92.1% 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 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 77.1% accurate, 1.5× speedup?

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

\\
uy \cdot \left(2 \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)\right)
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 77.1% accurate, 1.5× speedup?

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

\\
\left(uy \cdot \pi\right) \cdot \left(2 \cdot \sqrt{ux \cdot \left(2 - ux\right)}\right)
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.4% accurate, 1.5× speedup?

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

\\
uy \cdot \left(2 \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right)
\end{array}
Derivation
  1. Initial program 52.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*52.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. +-commutative52.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-52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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