UniformSampleCone, y

Percentage Accurate: 57.6% → 98.3%
Time: 15.4s
Alternatives: 16
Speedup: 4.2×

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 16 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.6% 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, 1.0× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in ux around inf

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
  4. Step-by-step derivation
    1. lower-*.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
    2. unpow2N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
    3. lower-*.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
    4. sub-negN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
    5. +-commutativeN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
    6. +-commutativeN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
    7. distribute-neg-inN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
    8. distribute-lft-neg-inN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
    9. metadata-evalN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
    10. associate-+l+N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
  5. Applied rewrites98.2%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
  6. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
    3. lower-*.f3298.2

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

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

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

Alternative 2: 97.0% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 uy #s(literal 2 binary32)) < 0.0219999999

    1. Initial program 60.5%

      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in ux around inf

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
      3. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
      4. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
      6. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
      7. distribute-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
      9. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
      10. associate-+l+N/A

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
    6. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
      3. lower-*.f3298.3

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

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

      \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    9. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      3. lower-fma.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
      4. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      6. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      7. cube-multN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      8. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      9. lower-PI.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      10. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      11. lower-PI.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      12. lower-PI.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
      13. lower-*.f32N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
      14. lower-PI.f3298.5

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

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

    if 0.0219999999 < (*.f32 uy #s(literal 2 binary32))

    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. Add Preprocessing
    3. Taylor expanded in ux around inf

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
      3. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
      4. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
      6. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
      7. distribute-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
      9. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
      10. associate-+l+N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
    5. Applied rewrites97.6%

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
    7. Step-by-step derivation
      1. Applied rewrites92.3%

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

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

    Alternative 3: 98.3% accurate, 1.0× speedup?

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

      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}} \]
      2. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + 1}} \]
      4. lift-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\right)\right) + 1} \]
      5. lift-+.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right)}\right)\right) + 1} \]
      6. distribute-rgt-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right) + \left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}\right)\right) + 1} \]
      7. distribute-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\left(\mathsf{neg}\left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + \left(\mathsf{neg}\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right)\right)} + 1} \]
      8. associate-+l+N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(1 - ux\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + \left(\left(\mathsf{neg}\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + 1\right)}} \]
      9. *-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\right)\right) + \left(\left(\mathsf{neg}\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + 1\right)} \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\mathsf{neg}\left(\left(1 - ux\right)\right)\right)} + \left(\left(\mathsf{neg}\left(\left(ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) + 1\right)} \]
      11. lower-fma.f32N/A

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \color{blue}{{ux}^{2} \cdot \left(-1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + \left(-1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)}\right)} \]
    6. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \color{blue}{{ux}^{2} \cdot \left(-1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + \left(-1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)}\right)} \]
      2. unpow2N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(-1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + \left(-1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)\right)} \]
      3. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \color{blue}{\left(ux \cdot ux\right)} \cdot \left(-1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + \left(-1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)\right)} \]
      4. associate-*r*N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(-1 \cdot maxCos\right) \cdot \left(maxCos - 1\right)} + \left(-1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)\right)} \]
      5. lower-fma.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \color{blue}{\mathsf{fma}\left(-1 \cdot maxCos, maxCos - 1, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)}\right)} \]
      6. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(maxCos\right)}, maxCos - 1, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)} \]
      7. lower-neg.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(maxCos\right)}, maxCos - 1, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)} \]
      8. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), \color{blue}{maxCos + \left(\mathsf{neg}\left(1\right)\right)}, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)} \]
      9. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + \color{blue}{-1}, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)} \]
      10. lower-+.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), \color{blue}{maxCos + -1}, -1 \cdot \frac{maxCos}{ux} + \frac{1}{{ux}^{2}}\right)\right)} \]
      11. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \color{blue}{\frac{1}{{ux}^{2}} + -1 \cdot \frac{maxCos}{ux}}\right)\right)} \]
      12. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \frac{1}{{ux}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{maxCos}{ux}\right)\right)}\right)\right)} \]
      13. unsub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \color{blue}{\frac{1}{{ux}^{2}} - \frac{maxCos}{ux}}\right)\right)} \]
      14. lower--.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \color{blue}{\frac{1}{{ux}^{2}} - \frac{maxCos}{ux}}\right)\right)} \]
      15. lower-/.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \color{blue}{\frac{1}{{ux}^{2}}} - \frac{maxCos}{ux}\right)\right)} \]
      16. unpow2N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \frac{1}{\color{blue}{ux \cdot ux}} - \frac{maxCos}{ux}\right)\right)} \]
      17. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, 1 - ux\right), \mathsf{neg}\left(\left(1 - ux\right)\right), \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(maxCos\right), maxCos + -1, \frac{1}{\color{blue}{ux \cdot ux}} - \frac{maxCos}{ux}\right)\right)} \]
      18. lower-/.f3256.9

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(1 + \left(-1 \cdot maxCos + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)\right)}} \]
    9. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(1 + \left(-1 \cdot maxCos + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)\right)}} \]
      2. associate-+r+N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(\left(1 + -1 \cdot maxCos\right) + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)}} \]
      3. lower-+.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(\left(1 + -1 \cdot maxCos\right) + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)}} \]
      4. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 + \color{blue}{\left(\mathsf{neg}\left(maxCos\right)\right)}\right) + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)} \]
      5. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(1 - maxCos\right)} + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)} \]
      6. lower--.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(1 - maxCos\right)} + \left(-1 \cdot \left(maxCos - 1\right) + ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right)\right)\right)} \]
      7. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \color{blue}{\left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + -1 \cdot \left(maxCos - 1\right)\right)}\right)} \]
      8. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\left(maxCos - 1\right)\right)\right)}\right)\right)} \]
      9. sub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \left(\mathsf{neg}\left(\color{blue}{\left(maxCos + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)\right)\right)\right)} \]
      10. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \left(\mathsf{neg}\left(\left(maxCos + \color{blue}{-1}\right)\right)\right)\right)\right)} \]
      11. distribute-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \color{blue}{\left(\left(\mathsf{neg}\left(maxCos\right)\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)}\right)\right)} \]
      12. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \left(\color{blue}{-1 \cdot maxCos} + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)\right)} \]
      13. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \left(-1 \cdot maxCos + \color{blue}{1}\right)\right)\right)} \]
      14. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(1 - maxCos\right) + \left(ux \cdot \left(\left(maxCos + -1 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right)\right) - 1\right) + \color{blue}{\left(1 + -1 \cdot maxCos\right)}\right)\right)} \]
      15. lower-fma.f32N/A

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

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

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

    Alternative 4: 98.3% accurate, 1.0× speedup?

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

      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in ux around 0

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}} \]
    4. Step-by-step derivation
      1. lower-*.f32N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}} \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right)} + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)} \]
      4. metadata-evalN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right) + \color{blue}{-2} \cdot maxCos\right)} \]
      5. associate-+l+N/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\right)\right)}} \]
      6. mul-1-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(\mathsf{neg}\left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)} + \left(2 + -2 \cdot maxCos\right)\right)} \]
      7. distribute-rgt-neg-inN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{ux \cdot \left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right)} + \left(2 + -2 \cdot maxCos\right)\right)} \]
      8. lower-fma.f32N/A

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

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

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

    Alternative 5: 97.0% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (if (<= (* 2.0 uy) 0.02199999988079071)
       (*
        (sqrt
         (fma
          (* ux ux)
          (* (+ maxCos -1.0) (- 1.0 maxCos))
          (* ux (fma maxCos -2.0 2.0))))
        (* uy (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI))))
       (* (sin (* (* 2.0 uy) PI)) (sqrt (fma ux 2.0 (* ux (- ux)))))))
    float code(float ux, float uy, float maxCos) {
    	float tmp;
    	if ((2.0f * uy) <= 0.02199999988079071f) {
    		tmp = sqrtf(fmaf((ux * ux), ((maxCos + -1.0f) * (1.0f - maxCos)), (ux * fmaf(maxCos, -2.0f, 2.0f)))) * (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI))));
    	} else {
    		tmp = sinf(((2.0f * uy) * ((float) M_PI))) * sqrtf(fmaf(ux, 2.0f, (ux * -ux)));
    	}
    	return tmp;
    }
    
    function code(ux, uy, maxCos)
    	tmp = Float32(0.0)
    	if (Float32(Float32(2.0) * uy) <= Float32(0.02199999988079071))
    		tmp = Float32(sqrt(fma(Float32(ux * ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(1.0) - maxCos)), Float32(ux * fma(maxCos, Float32(-2.0), Float32(2.0))))) * Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))));
    	else
    		tmp = Float32(sin(Float32(Float32(Float32(2.0) * uy) * Float32(pi))) * sqrt(fma(ux, Float32(2.0), Float32(ux * Float32(-ux)))));
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\
    \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f32 uy #s(literal 2 binary32)) < 0.0219999999

      1. Initial program 60.5%

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in ux around inf

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
      4. Step-by-step derivation
        1. lower-*.f32N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
        2. unpow2N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
        3. lower-*.f32N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
        4. sub-negN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
        5. +-commutativeN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
        6. +-commutativeN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
        7. distribute-neg-inN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
        8. distribute-lft-neg-inN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
        9. metadata-evalN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
        10. associate-+l+N/A

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
      6. Step-by-step derivation
        1. lift-*.f32N/A

          \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
        3. lower-*.f3298.3

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

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

        \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      9. Step-by-step derivation
        1. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        2. associate-*r*N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        3. lower-fma.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
        4. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        5. unpow2N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        6. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        7. cube-multN/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        8. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        9. lower-PI.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        10. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        11. lower-PI.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        12. lower-PI.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
        13. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
        14. lower-PI.f3298.5

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

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

      if 0.0219999999 < (*.f32 uy #s(literal 2 binary32))

      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. Add Preprocessing
      3. Taylor expanded in ux around inf

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
      4. Step-by-step derivation
        1. lower-*.f32N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
        2. unpow2N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
        3. lower-*.f32N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
        4. sub-negN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
        5. +-commutativeN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
        6. +-commutativeN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
        7. distribute-neg-inN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
        8. distribute-lft-neg-inN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
        9. metadata-evalN/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
        10. associate-+l+N/A

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
      5. Applied rewrites97.6%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
      6. Step-by-step derivation
        1. lift-*.f32N/A

          \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
        3. lower-*.f3297.6

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

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

        \[\leadsto \sqrt{-1 \cdot {ux}^{2} + \color{blue}{2 \cdot ux}} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
      9. Step-by-step derivation
        1. Applied rewrites92.3%

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

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

      Alternative 6: 97.0% accurate, 1.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \end{array} \end{array} \]
      (FPCore (ux uy maxCos)
       :precision binary32
       (if (<= (* 2.0 uy) 0.02199999988079071)
         (*
          (sqrt
           (fma
            (* ux ux)
            (* (+ maxCos -1.0) (- 1.0 maxCos))
            (* ux (fma maxCos -2.0 2.0))))
          (* uy (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI))))
         (* (sin (* (* 2.0 uy) PI)) (sqrt (* ux (- 2.0 ux))))))
      float code(float ux, float uy, float maxCos) {
      	float tmp;
      	if ((2.0f * uy) <= 0.02199999988079071f) {
      		tmp = sqrtf(fmaf((ux * ux), ((maxCos + -1.0f) * (1.0f - maxCos)), (ux * fmaf(maxCos, -2.0f, 2.0f)))) * (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI))));
      	} else {
      		tmp = sinf(((2.0f * uy) * ((float) M_PI))) * sqrtf((ux * (2.0f - ux)));
      	}
      	return tmp;
      }
      
      function code(ux, uy, maxCos)
      	tmp = Float32(0.0)
      	if (Float32(Float32(2.0) * uy) <= Float32(0.02199999988079071))
      		tmp = Float32(sqrt(fma(Float32(ux * ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(1.0) - maxCos)), Float32(ux * fma(maxCos, Float32(-2.0), Float32(2.0))))) * Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))));
      	else
      		tmp = Float32(sin(Float32(Float32(Float32(2.0) * uy) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\
      \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f32 uy #s(literal 2 binary32)) < 0.0219999999

        1. Initial program 60.5%

          \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in ux around inf

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
        4. Step-by-step derivation
          1. lower-*.f32N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
          2. unpow2N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
          3. lower-*.f32N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
          4. sub-negN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
          5. +-commutativeN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
          6. +-commutativeN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
          7. distribute-neg-inN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
          8. distribute-lft-neg-inN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
          9. metadata-evalN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
          10. associate-+l+N/A

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

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
        6. Step-by-step derivation
          1. lift-*.f32N/A

            \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
          3. lower-*.f3298.3

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

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

          \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
        9. Step-by-step derivation
          1. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
          2. associate-*r*N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          3. lower-fma.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
          4. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          5. unpow2N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          6. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          7. cube-multN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          8. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          9. lower-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          10. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          11. lower-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          12. lower-PI.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
          13. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
          14. lower-PI.f3298.5

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

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

        if 0.0219999999 < (*.f32 uy #s(literal 2 binary32))

        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. Add Preprocessing
        3. Taylor expanded in ux around inf

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
        4. Step-by-step derivation
          1. lower-*.f32N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
          2. unpow2N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
          3. lower-*.f32N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
          4. sub-negN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
          5. +-commutativeN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
          6. +-commutativeN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
          7. distribute-neg-inN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
          8. distribute-lft-neg-inN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
          9. metadata-evalN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
          10. associate-+l+N/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
        5. Applied rewrites97.6%

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
        6. Step-by-step derivation
          1. lift-*.f32N/A

            \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
          3. lower-*.f3297.6

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

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

          \[\leadsto \sqrt{-1 \cdot {ux}^{2} + \color{blue}{2 \cdot ux}} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
        9. Step-by-step derivation
          1. Applied rewrites92.3%

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

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

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

          Alternative 7: 93.7% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.041999999433755875:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2}\\ \end{array} \end{array} \]
          (FPCore (ux uy maxCos)
           :precision binary32
           (if (<= (* 2.0 uy) 0.041999999433755875)
             (*
              (sqrt
               (fma
                (* ux ux)
                (* (+ maxCos -1.0) (- 1.0 maxCos))
                (* ux (fma maxCos -2.0 2.0))))
              (* uy (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI))))
             (* (sin (* (* 2.0 uy) PI)) (sqrt (* ux 2.0)))))
          float code(float ux, float uy, float maxCos) {
          	float tmp;
          	if ((2.0f * uy) <= 0.041999999433755875f) {
          		tmp = sqrtf(fmaf((ux * ux), ((maxCos + -1.0f) * (1.0f - maxCos)), (ux * fmaf(maxCos, -2.0f, 2.0f)))) * (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI))));
          	} else {
          		tmp = sinf(((2.0f * uy) * ((float) M_PI))) * sqrtf((ux * 2.0f));
          	}
          	return tmp;
          }
          
          function code(ux, uy, maxCos)
          	tmp = Float32(0.0)
          	if (Float32(Float32(2.0) * uy) <= Float32(0.041999999433755875))
          		tmp = Float32(sqrt(fma(Float32(ux * ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(1.0) - maxCos)), Float32(ux * fma(maxCos, Float32(-2.0), Float32(2.0))))) * Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))));
          	else
          		tmp = Float32(sin(Float32(Float32(Float32(2.0) * uy) * Float32(pi))) * sqrt(Float32(ux * Float32(2.0))));
          	end
          	return tmp
          end
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;2 \cdot uy \leq 0.041999999433755875:\\
          \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\sin \left(\left(2 \cdot uy\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f32 uy #s(literal 2 binary32)) < 0.0419999994

            1. Initial program 60.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. Add Preprocessing
            3. Taylor expanded in ux around inf

              \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
            4. Step-by-step derivation
              1. lower-*.f32N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
              2. unpow2N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
              3. lower-*.f32N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
              4. sub-negN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
              5. +-commutativeN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
              6. +-commutativeN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
              7. distribute-neg-inN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
              8. distribute-lft-neg-inN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
              9. metadata-evalN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
              10. associate-+l+N/A

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

              \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
            6. Step-by-step derivation
              1. lift-*.f32N/A

                \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
              3. lower-*.f3298.3

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

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

              \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
            9. Step-by-step derivation
              1. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
              2. associate-*r*N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              3. lower-fma.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
              4. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              5. unpow2N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              6. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              7. cube-multN/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              8. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              9. lower-PI.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              10. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              11. lower-PI.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              12. lower-PI.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
              13. lower-*.f32N/A

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
              14. lower-PI.f3298.1

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

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

            if 0.0419999994 < (*.f32 uy #s(literal 2 binary32))

            1. Initial program 46.0%

              \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in ux around inf

              \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
            4. Step-by-step derivation
              1. lower-*.f32N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
              2. unpow2N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
              3. lower-*.f32N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
              4. sub-negN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
              5. +-commutativeN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
              6. +-commutativeN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
              7. distribute-neg-inN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
              8. distribute-lft-neg-inN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
              9. metadata-evalN/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
              10. associate-+l+N/A

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
            5. Applied rewrites97.5%

              \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
            6. Step-by-step derivation
              1. lift-*.f32N/A

                \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
              3. lower-*.f3297.5

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

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

              \[\leadsto \sqrt{-1 \cdot {ux}^{2} + \color{blue}{2 \cdot ux}} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
            9. Step-by-step derivation
              1. Applied rewrites91.5%

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

                \[\leadsto \sqrt{2 \cdot ux} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
              3. Step-by-step derivation
                1. Applied rewrites79.8%

                  \[\leadsto \sqrt{2 \cdot ux} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \]
              4. Recombined 2 regimes into one program.
              5. Final simplification94.6%

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

              Alternative 8: 89.6% accurate, 1.8× speedup?

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

                \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in ux around inf

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
              4. Step-by-step derivation
                1. lower-*.f32N/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                2. unpow2N/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                3. lower-*.f32N/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                4. sub-negN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                5. +-commutativeN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                6. +-commutativeN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                7. distribute-neg-inN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                8. distribute-lft-neg-inN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                9. metadata-evalN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                10. associate-+l+N/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
              5. Applied rewrites98.2%

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
              6. Step-by-step derivation
                1. lift-*.f32N/A

                  \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                3. lower-*.f3298.2

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

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

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
              9. Step-by-step derivation
                1. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                2. associate-*r*N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                3. lower-fma.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                4. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                5. unpow2N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                6. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                7. cube-multN/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                8. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                9. lower-PI.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                10. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                11. lower-PI.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                12. lower-PI.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                13. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
                14. lower-PI.f3289.0

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

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

                \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \]
              12. Add Preprocessing

              Alternative 9: 85.2% accurate, 2.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.0014250000240281224:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)}\\ \end{array} \end{array} \]
              (FPCore (ux uy maxCos)
               :precision binary32
               (if (<= (* 2.0 uy) 0.0014250000240281224)
                 (*
                  (sqrt
                   (fma
                    (* ux ux)
                    (* (+ maxCos -1.0) (- 1.0 maxCos))
                    (* ux (fma maxCos -2.0 2.0))))
                  (* 2.0 (* uy PI)))
                 (*
                  (* uy (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI)))
                  (sqrt (* ux (fma -2.0 maxCos 2.0))))))
              float code(float ux, float uy, float maxCos) {
              	float tmp;
              	if ((2.0f * uy) <= 0.0014250000240281224f) {
              		tmp = sqrtf(fmaf((ux * ux), ((maxCos + -1.0f) * (1.0f - maxCos)), (ux * fmaf(maxCos, -2.0f, 2.0f)))) * (2.0f * (uy * ((float) M_PI)));
              	} else {
              		tmp = (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)))) * sqrtf((ux * fmaf(-2.0f, maxCos, 2.0f)));
              	}
              	return tmp;
              }
              
              function code(ux, uy, maxCos)
              	tmp = Float32(0.0)
              	if (Float32(Float32(2.0) * uy) <= Float32(0.0014250000240281224))
              		tmp = Float32(sqrt(fma(Float32(ux * ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(1.0) - maxCos)), Float32(ux * fma(maxCos, Float32(-2.0), Float32(2.0))))) * Float32(Float32(2.0) * Float32(uy * Float32(pi))));
              	else
              		tmp = Float32(Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))) * sqrt(Float32(ux * fma(Float32(-2.0), maxCos, Float32(2.0)))));
              	end
              	return tmp
              end
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;2 \cdot uy \leq 0.0014250000240281224:\\
              \;\;\;\;\sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f32 uy #s(literal 2 binary32)) < 0.00142500002

                1. Initial program 60.7%

                  \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in ux around inf

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                4. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  2. unpow2N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  4. sub-negN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                  5. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                  6. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  7. distribute-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                  8. distribute-lft-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  9. metadata-evalN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  10. associate-+l+N/A

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

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                6. Step-by-step derivation
                  1. lift-*.f32N/A

                    \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                  2. *-commutativeN/A

                    \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                  3. lower-*.f3298.3

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

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

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                9. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                  2. lower-*.f32N/A

                    \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                  3. lower-PI.f3297.5

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

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

                if 0.00142500002 < (*.f32 uy #s(literal 2 binary32))

                1. Initial program 51.1%

                  \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in ux around inf

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                4. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  2. unpow2N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  4. sub-negN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                  5. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                  6. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  7. distribute-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                  8. distribute-lft-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  9. metadata-evalN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  10. associate-+l+N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                5. Applied rewrites97.9%

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

                  \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                7. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  2. lower-*.f32N/A

                    \[\leadsto \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  3. lower-PI.f3249.3

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

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

                  \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                10. Step-by-step derivation
                  1. cancel-sign-sub-invN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
                  2. metadata-evalN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{-2} \cdot maxCos\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -2 \cdot maxCos\right)}} \]
                  4. +-commutativeN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + 2\right)}} \]
                  5. lower-fma.f3247.4

                    \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)}} \]
                11. Applied rewrites47.4%

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

                  \[\leadsto \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                13. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  2. associate-*r*N/A

                    \[\leadsto \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  3. lower-fma.f32N/A

                    \[\leadsto \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  4. lower-*.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  5. unpow2N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  6. lower-*.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  7. cube-multN/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  8. lower-*.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  9. lower-PI.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  10. lower-*.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  11. lower-PI.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  12. lower-PI.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  13. lower-*.f32N/A

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                  14. lower-PI.f3261.9

                    \[\leadsto \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
                14. Applied rewrites61.9%

                  \[\leadsto \color{blue}{\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right)} \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification85.4%

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

              Alternative 10: 75.9% accurate, 2.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 + \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(ux + -1\right) - ux \cdot maxCos\right) \leq 0.00019999999494757503:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(1 - ux, ux + -1, 1\right)}\right)\\ \end{array} \end{array} \]
              (FPCore (ux uy maxCos)
               :precision binary32
               (if (<=
                    (+ 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (- (+ ux -1.0) (* ux maxCos))))
                    0.00019999999494757503)
                 (* (* 2.0 (* uy PI)) (sqrt (* ux (fma -2.0 maxCos 2.0))))
                 (* 2.0 (* (* uy PI) (sqrt (fma (- 1.0 ux) (+ ux -1.0) 1.0))))))
              float code(float ux, float uy, float maxCos) {
              	float tmp;
              	if ((1.0f + (((1.0f - ux) + (ux * maxCos)) * ((ux + -1.0f) - (ux * maxCos)))) <= 0.00019999999494757503f) {
              		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * fmaf(-2.0f, maxCos, 2.0f)));
              	} else {
              		tmp = 2.0f * ((uy * ((float) M_PI)) * sqrtf(fmaf((1.0f - ux), (ux + -1.0f), 1.0f)));
              	}
              	return tmp;
              }
              
              function code(ux, uy, maxCos)
              	tmp = Float32(0.0)
              	if (Float32(Float32(1.0) + Float32(Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos)) * Float32(Float32(ux + Float32(-1.0)) - Float32(ux * maxCos)))) <= Float32(0.00019999999494757503))
              		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * fma(Float32(-2.0), maxCos, Float32(2.0)))));
              	else
              		tmp = Float32(Float32(2.0) * Float32(Float32(uy * Float32(pi)) * sqrt(fma(Float32(Float32(1.0) - ux), Float32(ux + Float32(-1.0)), Float32(1.0)))));
              	end
              	return tmp
              end
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;1 + \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(ux + -1\right) - ux \cdot maxCos\right) \leq 0.00019999999494757503:\\
              \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(1 - ux, ux + -1, 1\right)}\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)))) < 1.99999995e-4

                1. Initial program 36.3%

                  \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in ux around inf

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                4. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  2. unpow2N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                  4. sub-negN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                  5. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                  6. +-commutativeN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  7. distribute-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                  8. distribute-lft-neg-inN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  9. metadata-evalN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                  10. associate-+l+N/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                5. Applied rewrites98.1%

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

                  \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                7. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  2. lower-*.f32N/A

                    \[\leadsto \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  3. lower-PI.f3278.0

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

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

                  \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                10. Step-by-step derivation
                  1. cancel-sign-sub-invN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
                  2. metadata-evalN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{-2} \cdot maxCos\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -2 \cdot maxCos\right)}} \]
                  4. +-commutativeN/A

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + 2\right)}} \]
                  5. lower-fma.f3274.2

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

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

                if 1.99999995e-4 < (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))

                1. Initial program 88.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. Add Preprocessing
                3. Taylor expanded in uy around 0

                  \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                4. Step-by-step derivation
                  1. lower-*.f32N/A

                    \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                  2. lower-*.f32N/A

                    \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                  3. lower-*.f32N/A

                    \[\leadsto 2 \cdot \left(\color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \]
                  4. lower-PI.f32N/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \]
                  5. lower-sqrt.f32N/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}}\right) \]
                  6. sub-negN/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}\right)\right)}}\right) \]
                  7. +-commutativeN/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}\right)\right) + 1}}\right) \]
                  8. unpow2N/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 + maxCos \cdot ux\right) - ux\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)}\right)\right) + 1}\right) \]
                  9. distribute-rgt-neg-inN/A

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 + maxCos \cdot ux\right) - ux\right) \cdot \left(\mathsf{neg}\left(\left(\left(1 + maxCos \cdot ux\right) - ux\right)\right)\right)} + 1}\right) \]
                  10. lower-fma.f32N/A

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

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

                  \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 + \left(1 - ux\right) \cdot \left(ux - 1\right)}\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites76.1%

                    \[\leadsto 2 \cdot \left(\left(uy \cdot \pi\right) \cdot \sqrt{\mathsf{fma}\left(1 - ux, ux + -1, 1\right)}\right) \]
                8. Recombined 2 regimes into one program.
                9. Final simplification75.0%

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

                Alternative 11: 88.2% accurate, 2.2× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 1.4999999621068127 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}\\ \end{array} \end{array} \]
                (FPCore (ux uy maxCos)
                 :precision binary32
                 (if (<= maxCos 1.4999999621068127e-5)
                   (*
                    (* uy (fma (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI)) (* 2.0 PI)))
                    (sqrt (fma ux 2.0 (* ux (- ux)))))
                   (*
                    (* 2.0 (* uy PI))
                    (sqrt
                     (*
                      (* ux ux)
                      (fma (+ maxCos -1.0) (- 1.0 maxCos) (/ (fma maxCos -2.0 2.0) ux)))))))
                float code(float ux, float uy, float maxCos) {
                	float tmp;
                	if (maxCos <= 1.4999999621068127e-5f) {
                		tmp = (uy * fmaf((-1.3333333333333333f * (uy * uy)), (((float) M_PI) * (((float) M_PI) * ((float) M_PI))), (2.0f * ((float) M_PI)))) * sqrtf(fmaf(ux, 2.0f, (ux * -ux)));
                	} else {
                		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf(((ux * ux) * fmaf((maxCos + -1.0f), (1.0f - maxCos), (fmaf(maxCos, -2.0f, 2.0f) / ux))));
                	}
                	return tmp;
                }
                
                function code(ux, uy, maxCos)
                	tmp = Float32(0.0)
                	if (maxCos <= Float32(1.4999999621068127e-5))
                		tmp = Float32(Float32(uy * fma(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)), Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))), Float32(Float32(2.0) * Float32(pi)))) * sqrt(fma(ux, Float32(2.0), Float32(ux * Float32(-ux)))));
                	else
                		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * fma(Float32(maxCos + Float32(-1.0)), Float32(Float32(1.0) - maxCos), Float32(fma(maxCos, Float32(-2.0), Float32(2.0)) / ux)))));
                	end
                	return tmp
                end
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;maxCos \leq 1.4999999621068127 \cdot 10^{-5}:\\
                \;\;\;\;\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if maxCos < 1.49999996e-5

                  1. Initial program 57.9%

                    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in ux around inf

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  4. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    3. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    4. sub-negN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                    5. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                    6. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    7. distribute-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                    8. distribute-lft-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    9. metadata-evalN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    10. associate-+l+N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                  5. Applied rewrites98.2%

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                  6. Step-by-step derivation
                    1. lift-*.f32N/A

                      \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                    2. *-commutativeN/A

                      \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                    3. lower-*.f3298.2

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

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

                    \[\leadsto \sqrt{-1 \cdot {ux}^{2} + \color{blue}{2 \cdot ux}} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
                  9. Step-by-step derivation
                    1. Applied rewrites97.5%

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

                      \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                    3. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \color{blue}{\left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                      2. associate-*r*N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \left(\color{blue}{\left(\frac{-4}{3} \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      3. lower-fma.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \color{blue}{\mathsf{fma}\left(\frac{-4}{3} \cdot {uy}^{2}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                      4. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\color{blue}{\frac{-4}{3} \cdot {uy}^{2}}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      5. unpow2N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      6. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \color{blue}{\left(uy \cdot uy\right)}, {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      7. cube-multN/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      8. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      9. lower-PI.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      10. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      11. lower-PI.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      12. lower-PI.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \]
                      13. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3} \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{2 \cdot \mathsf{PI}\left(\right)}\right)\right) \]
                      14. lower-PI.f3288.9

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \color{blue}{\pi}\right)\right) \]
                    4. Applied rewrites88.9%

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

                    if 1.49999996e-5 < maxCos

                    1. Initial program 54.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. Add Preprocessing
                    3. Taylor expanded in ux around inf

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    4. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                      2. unpow2N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                      3. lower-*.f32N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                      4. sub-negN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                      5. +-commutativeN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                      6. +-commutativeN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      7. distribute-neg-inN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                      8. distribute-lft-neg-inN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      9. metadata-evalN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      10. associate-+l+N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                    5. Applied rewrites97.9%

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

                      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                    7. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                      2. lower-*.f32N/A

                        \[\leadsto \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                      3. lower-PI.f3280.5

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

                      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \pi\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  10. Recombined 2 regimes into one program.
                  11. Final simplification87.9%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 1.4999999621068127 \cdot 10^{-5}:\\ \;\;\;\;\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right), \pi \cdot \left(\pi \cdot \pi\right), 2 \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}\\ \end{array} \]
                  12. Add Preprocessing

                  Alternative 12: 82.0% accurate, 2.6× speedup?

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

                    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in ux around inf

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  4. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    3. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    4. sub-negN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                    5. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                    6. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    7. distribute-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                    8. distribute-lft-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    9. metadata-evalN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    10. associate-+l+N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                  5. Applied rewrites98.2%

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                  6. Step-by-step derivation
                    1. lift-*.f32N/A

                      \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                    2. *-commutativeN/A

                      \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                    3. lower-*.f3298.2

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

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

                    \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                  9. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right) \cdot ux\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                    2. lower-*.f32N/A

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

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

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

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

                  Alternative 13: 82.0% accurate, 2.9× speedup?

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

                    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in ux around inf

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  4. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    3. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    4. sub-negN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                    5. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                    6. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    7. distribute-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                    8. distribute-lft-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    9. metadata-evalN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    10. associate-+l+N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                  5. Applied rewrites98.2%

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

                    \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                  7. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                    2. lower-*.f32N/A

                      \[\leadsto \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                    3. lower-PI.f3281.1

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

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

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                  10. Step-by-step derivation
                    1. cancel-sign-sub-invN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
                    2. metadata-evalN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{-2} \cdot maxCos\right)} \]
                    3. lower-*.f32N/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -2 \cdot maxCos\right)}} \]
                    4. +-commutativeN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + 2\right)}} \]
                    5. lower-fma.f3264.8

                      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)}} \]
                  11. Applied rewrites64.8%

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

                    \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}} \]
                  13. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}} \]
                    2. cancel-sign-sub-invN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
                    3. metadata-evalN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot maxCos\right)} \]
                    4. +-commutativeN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(\color{blue}{\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + 2\right)} + -2 \cdot maxCos\right)} \]
                    5. associate-+l+N/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + -2 \cdot maxCos\right)\right)}} \]
                    6. metadata-evalN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \left(2 + \color{blue}{\left(\mathsf{neg}\left(2\right)\right)} \cdot maxCos\right)\right)} \]
                    7. cancel-sign-sub-invN/A

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(-1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right) + \color{blue}{\left(2 - 2 \cdot maxCos\right)}\right)} \]
                  14. Applied rewrites81.0%

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

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

                  Alternative 14: 77.5% accurate, 4.0× speedup?

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

                    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in ux around inf

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  4. Step-by-step derivation
                    1. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    2. unpow2N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    3. lower-*.f32N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                    4. sub-negN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                    5. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                    6. +-commutativeN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    7. distribute-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                    8. distribute-lft-neg-inN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    9. metadata-evalN/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                    10. associate-+l+N/A

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                  5. Applied rewrites98.2%

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                  6. Step-by-step derivation
                    1. lift-*.f32N/A

                      \[\leadsto \color{blue}{\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}} \]
                    2. *-commutativeN/A

                      \[\leadsto \color{blue}{\sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                    3. lower-*.f3298.2

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

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

                    \[\leadsto \sqrt{-1 \cdot {ux}^{2} + \color{blue}{2 \cdot ux}} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \]
                  9. Step-by-step derivation
                    1. Applied rewrites92.6%

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

                      \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                    3. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                      2. lower-*.f32N/A

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(\mathsf{neg}\left(ux\right)\right)\right)} \cdot \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                      3. lower-PI.f3277.2

                        \[\leadsto \sqrt{\mathsf{fma}\left(ux, 2, ux \cdot \left(-ux\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \color{blue}{\pi}\right)\right) \]
                    4. Applied rewrites77.2%

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

                    Alternative 15: 66.2% accurate, 4.2× speedup?

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

                      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in ux around inf

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                    4. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                      2. unpow2N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                      3. lower-*.f32N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(ux \cdot ux\right)} \cdot \left(2 \cdot \frac{1}{ux} - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)} \]
                      4. sub-negN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}} \]
                      5. +-commutativeN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right)\right) + 2 \cdot \frac{1}{ux}\right)}} \]
                      6. +-commutativeN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left({\left(maxCos - 1\right)}^{2} + 2 \cdot \frac{maxCos}{ux}\right)}\right)\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      7. distribute-neg-inN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(\mathsf{neg}\left(2 \cdot \frac{maxCos}{ux}\right)\right)\right)} + 2 \cdot \frac{1}{ux}\right)} \]
                      8. distribute-lft-neg-inN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(2\right)\right) \cdot \frac{maxCos}{ux}}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      9. metadata-evalN/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \color{blue}{-2} \cdot \frac{maxCos}{ux}\right) + 2 \cdot \frac{1}{ux}\right)} \]
                      10. associate-+l+N/A

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left({\left(maxCos - 1\right)}^{2}\right)\right) + \left(-2 \cdot \frac{maxCos}{ux} + 2 \cdot \frac{1}{ux}\right)\right)}} \]
                    5. Applied rewrites98.2%

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

                      \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                    7. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \color{blue}{\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                      2. lower-*.f32N/A

                        \[\leadsto \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
                      3. lower-PI.f3281.1

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

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

                      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                    10. Step-by-step derivation
                      1. cancel-sign-sub-invN/A

                        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right)}} \]
                      2. metadata-evalN/A

                        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{-2} \cdot maxCos\right)} \]
                      3. lower-*.f32N/A

                        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -2 \cdot maxCos\right)}} \]
                      4. +-commutativeN/A

                        \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + 2\right)}} \]
                      5. lower-fma.f3264.8

                        \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)}} \]
                    11. Applied rewrites64.8%

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

                    Alternative 16: -0.0% accurate, 4.3× speedup?

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

                      \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in uy around 0

                      \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                    4. Step-by-step derivation
                      1. lower-*.f32N/A

                        \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                      2. lower-*.f32N/A

                        \[\leadsto 2 \cdot \color{blue}{\left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)} \]
                      3. lower-*.f32N/A

                        \[\leadsto 2 \cdot \left(\color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)} \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \]
                      4. lower-PI.f32N/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right) \]
                      5. lower-sqrt.f32N/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}}\right) \]
                      6. sub-negN/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}\right)\right)}}\right) \]
                      7. +-commutativeN/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}\right)\right) + 1}}\right) \]
                      8. unpow2N/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(\left(1 + maxCos \cdot ux\right) - ux\right) \cdot \left(\left(1 + maxCos \cdot ux\right) - ux\right)}\right)\right) + 1}\right) \]
                      9. distribute-rgt-neg-inN/A

                        \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\left(1 + maxCos \cdot ux\right) - ux\right) \cdot \left(\mathsf{neg}\left(\left(\left(1 + maxCos \cdot ux\right) - ux\right)\right)\right)} + 1}\right) \]
                      10. lower-fma.f32N/A

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

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

                      \[\leadsto 2 \cdot \left(maxCos \cdot \color{blue}{\left(ux \cdot \left(uy \cdot \left(\mathsf{PI}\left(\right) \cdot \sqrt{-1}\right)\right)\right)}\right) \]
                    7. Step-by-step derivation
                      1. Applied rewrites-0.0%

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

                        \[\leadsto 2 \cdot \left(\left(ux \cdot maxCos\right) \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-1}\right)\right)\right) \]
                      3. Add Preprocessing

                      Reproduce

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