UniformSampleCone, y

Percentage Accurate: 57.3% → 98.4%
Time: 15.8s
Alternatives: 15
Speedup: 5.0×

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 15 alternatives:

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

Initial Program: 57.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 1.0× speedup?

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

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

    \[\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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
    3. lower-*.f3298.4

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

\\
\sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)}
\end{array}
Derivation
  1. Initial program 58.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 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. metadata-evalN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
    6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.7% accurate, 1.0× speedup?

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

\\
\sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2 - ux, \left(ux \cdot maxCos\right) \cdot \mathsf{fma}\left(2, ux, -2\right)\right)}
\end{array}
Derivation
  1. Initial program 58.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 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. metadata-evalN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
    6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 97.3% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(2, \pi, -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, -ux \cdot ux\right)}\\ \end{array} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (if (<= (* 2.0 uy) 0.02199999988079071)
       (*
        (sqrt
         (fma
          ux
          (fma maxCos -2.0 2.0)
          (* (+ maxCos -1.0) (* (- 1.0 maxCos) (* ux ux)))))
        (* uy (fma 2.0 PI (* -1.3333333333333333 (* (* uy uy) (* PI (* PI 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, fmaf(maxCos, -2.0f, 2.0f), ((maxCos + -1.0f) * ((1.0f - maxCos) * (ux * ux))))) * (uy * fmaf(2.0f, ((float) M_PI), (-1.3333333333333333f * ((uy * uy) * (((float) M_PI) * (((float) M_PI) * ((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(ux, fma(maxCos, Float32(-2.0), Float32(2.0)), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * ux))))) * Float32(uy * fma(Float32(2.0), Float32(pi), Float32(Float32(-1.3333333333333333) * Float32(Float32(uy * uy) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))))));
    	else
    		tmp = Float32(sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))) * sqrt(fma(ux, Float32(2.0), Float32(-Float32(ux * ux)))));
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;2 \cdot uy \leq 0.02199999988079071:\\
    \;\;\;\;\sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(2, \pi, -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\mathsf{fma}\left(ux, 2, -ux \cdot 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 57.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.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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
        3. lower-*.f3298.6

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

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

        \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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)} \]
      9. Step-by-step derivation
        1. lower-*.f32N/A

          \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 61.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 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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
        3. lower-*.f3297.9

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

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

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

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

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

      Alternative 5: 97.3% accurate, 1.1× speedup?

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

        1. Initial program 57.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.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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
          3. lower-*.f3298.6

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

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

          \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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)} \]
        9. Step-by-step derivation
          1. lower-*.f32N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 61.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 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. metadata-evalN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
          6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\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 \cdot \color{blue}{\left(2 + -1 \cdot ux\right)}} \]
        7. Step-by-step derivation
          1. Applied rewrites94.9%

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

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

        Alternative 6: 97.0% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos, ux \cdot -2, ux \cdot \left(2 - ux\right)\right)} \end{array} \]
        (FPCore (ux uy maxCos)
         :precision binary32
         (* (sin (* PI (* 2.0 uy))) (sqrt (fma maxCos (* ux -2.0) (* ux (- 2.0 ux))))))
        float code(float ux, float uy, float maxCos) {
        	return sinf((((float) M_PI) * (2.0f * uy))) * sqrtf(fmaf(maxCos, (ux * -2.0f), (ux * (2.0f - ux))));
        }
        
        function code(ux, uy, maxCos)
        	return Float32(sin(Float32(Float32(pi) * Float32(Float32(2.0) * uy))) * sqrt(fma(maxCos, Float32(ux * Float32(-2.0)), Float32(ux * Float32(Float32(2.0) - ux)))))
        end
        
        \begin{array}{l}
        
        \\
        \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \sqrt{\mathsf{fma}\left(maxCos, ux \cdot -2, ux \cdot \left(2 - ux\right)\right)}
        \end{array}
        
        Derivation
        1. Initial program 58.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 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. metadata-evalN/A

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
          6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 7: 94.0% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;2 \cdot uy \leq 0.05999999865889549:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(2, \pi, -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot 2}\\ \end{array} \end{array} \]
            (FPCore (ux uy maxCos)
             :precision binary32
             (if (<= (* 2.0 uy) 0.05999999865889549)
               (*
                (sqrt
                 (fma
                  ux
                  (fma maxCos -2.0 2.0)
                  (* (+ maxCos -1.0) (* (- 1.0 maxCos) (* ux ux)))))
                (* uy (fma 2.0 PI (* -1.3333333333333333 (* (* uy uy) (* PI (* PI 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.05999999865889549f) {
            		tmp = sqrtf(fmaf(ux, fmaf(maxCos, -2.0f, 2.0f), ((maxCos + -1.0f) * ((1.0f - maxCos) * (ux * ux))))) * (uy * fmaf(2.0f, ((float) M_PI), (-1.3333333333333333f * ((uy * uy) * (((float) M_PI) * (((float) M_PI) * ((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.05999999865889549))
            		tmp = Float32(sqrt(fma(ux, fma(maxCos, Float32(-2.0), Float32(2.0)), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(Float32(1.0) - maxCos) * Float32(ux * ux))))) * Float32(uy * fma(Float32(2.0), Float32(pi), Float32(Float32(-1.3333333333333333) * Float32(Float32(uy * uy) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi))))))));
            	else
            		tmp = Float32(sin(Float32(Float32(2.0) * Float32(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.05999999865889549:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(2, \pi, -1.3333333333333333 \cdot \left(\left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\sin \left(2 \cdot \left(uy \cdot \pi\right)\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.0599999987

              1. Initial program 58.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 rewrites98.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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                3. lower-*.f3298.6

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

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

                \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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)} \]
              9. Step-by-step derivation
                1. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 58.6%

                \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
              2. 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.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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                3. lower-*.f3297.2

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 89.3% accurate, 1.8× speedup?

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

                \[\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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                3. lower-*.f3298.4

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

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

                \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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)} \]
              9. Step-by-step derivation
                1. lower-*.f32N/A

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 9: 89.3% accurate, 2.0× speedup?

              \[\begin{array}{l} \\ \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \pi\right)\right) \end{array} \]
              (FPCore (ux uy maxCos)
               :precision binary32
               (*
                (sqrt
                 (* ux (fma -2.0 maxCos (fma (fma ux maxCos (- ux)) (- 1.0 maxCos) 2.0))))
                (* uy (fma -1.3333333333333333 (* (* uy uy) (* PI (* PI PI))) (* 2.0 PI)))))
              float code(float ux, float uy, float maxCos) {
              	return sqrtf((ux * fmaf(-2.0f, maxCos, fmaf(fmaf(ux, maxCos, -ux), (1.0f - maxCos), 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(Float32(ux * fma(Float32(-2.0), maxCos, fma(fma(ux, maxCos, Float32(-ux)), Float32(Float32(1.0) - maxCos), Float32(2.0))))) * Float32(uy * fma(Float32(-1.3333333333333333), Float32(Float32(uy * uy) * Float32(Float32(pi) * Float32(Float32(pi) * Float32(pi)))), Float32(Float32(2.0) * Float32(pi)))))
              end
              
              \begin{array}{l}
              
              \\
              \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)} \cdot \left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, \left(uy \cdot uy\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right), 2 \cdot \pi\right)\right)
              \end{array}
              
              Derivation
              1. Initial program 58.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 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. metadata-evalN/A

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)}} \]
              6. 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, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, \mathsf{neg}\left(ux\right)\right), 1 - maxCos, 2\right)\right)} \]
              7. 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, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, \mathsf{neg}\left(ux\right)\right), 1 - maxCos, 2\right)\right)} \]
                2. lower-fma.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 10: 84.9% accurate, 2.1× speedup?

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

                1. Initial program 58.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 rewrites98.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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                  3. lower-*.f3298.5

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

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

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\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, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                  3. lower-PI.f3297.0

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

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

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

                1. Initial program 58.7%

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

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

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

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

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\left(1 - ux\right)} \cdot \left(1 - ux\right)} \]
                  4. lower--.f3256.8

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

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

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

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \mathsf{fma}\left(ux, \color{blue}{ux + -2}, 1\right)} \]
                  2. 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{1 - \mathsf{fma}\left(ux, ux + -2, 1\right)} \]
                  3. 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{1 - \mathsf{fma}\left(ux, ux + -2, 1\right)} \]
                    2. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(uy \cdot \mathsf{fma}\left(2, \mathsf{PI}\left(\right), \frac{-4}{3} \cdot \left(\left(uy \cdot uy\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\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(uy \cdot \mathsf{fma}\left(2, \mathsf{PI}\left(\right), \frac{-4}{3} \cdot \left(\left(uy \cdot uy\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{-2} \cdot maxCos\right)} \]
                    3. lower-*.f32N/A

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

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

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

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

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

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

                Alternative 11: 81.5% accurate, 2.6× speedup?

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

                  \[\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(-2, maxCos, 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(-2, maxCos, 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(-2, maxCos, 2\right)}{ux}\right)} \cdot \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)} \]
                  3. lower-*.f3298.4

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

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

                  \[\leadsto \sqrt{\mathsf{fma}\left(ux, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\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, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot 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, \mathsf{fma}\left(maxCos, -2, 2\right), \left(maxCos + -1\right) \cdot \left(\left(1 - maxCos\right) \cdot \left(ux \cdot ux\right)\right)\right)} \cdot \left(2 \cdot \color{blue}{\left(uy \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                  3. lower-PI.f3280.8

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

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

                Alternative 12: 81.5% accurate, 2.9× speedup?

                \[\begin{array}{l} \\ \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \pi\right)\right) \end{array} \]
                (FPCore (ux uy maxCos)
                 :precision binary32
                 (*
                  (sqrt
                   (* ux (fma -2.0 maxCos (fma (fma ux maxCos (- ux)) (- 1.0 maxCos) 2.0))))
                  (* 2.0 (* uy PI))))
                float code(float ux, float uy, float maxCos) {
                	return sqrtf((ux * fmaf(-2.0f, maxCos, fmaf(fmaf(ux, maxCos, -ux), (1.0f - maxCos), 2.0f)))) * (2.0f * (uy * ((float) M_PI)));
                }
                
                function code(ux, uy, maxCos)
                	return Float32(sqrt(Float32(ux * fma(Float32(-2.0), maxCos, fma(fma(ux, maxCos, Float32(-ux)), Float32(Float32(1.0) - maxCos), Float32(2.0))))) * Float32(Float32(2.0) * Float32(uy * Float32(pi))))
                end
                
                \begin{array}{l}
                
                \\
                \sqrt{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\right)} \cdot \left(2 \cdot \left(uy \cdot \pi\right)\right)
                \end{array}
                
                Derivation
                1. Initial program 58.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 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. metadata-evalN/A

                    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(-2 \cdot maxCos + \left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{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{ux \cdot \color{blue}{\mathsf{fma}\left(-2, maxCos, 2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}} \]
                  6. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, -ux\right), 1 - maxCos, 2\right)\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{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, \mathsf{neg}\left(ux\right)\right), 1 - maxCos, 2\right)\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{ux \cdot \mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(\mathsf{fma}\left(ux, maxCos, \mathsf{neg}\left(ux\right)\right), 1 - maxCos, 2\right)\right)} \]
                  2. lower-*.f32N/A

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

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

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

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

                Alternative 13: 77.3% accurate, 3.1× speedup?

                \[\begin{array}{l} \\ \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(-1 + \frac{2}{ux}\right)} \end{array} \]
                (FPCore (ux uy maxCos)
                 :precision binary32
                 (* (* 2.0 (* uy PI)) (sqrt (* (* ux ux) (+ -1.0 (/ 2.0 ux))))))
                float code(float ux, float uy, float maxCos) {
                	return (2.0f * (uy * ((float) M_PI))) * sqrtf(((ux * ux) * (-1.0f + (2.0f / ux))));
                }
                
                function code(ux, uy, maxCos)
                	return Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(Float32(ux * ux) * Float32(Float32(-1.0) + Float32(Float32(2.0) / ux)))))
                end
                
                function tmp = code(ux, uy, maxCos)
                	tmp = (single(2.0) * (uy * single(pi))) * sqrt(((ux * ux) * (single(-1.0) + (single(2.0) / ux))));
                end
                
                \begin{array}{l}
                
                \\
                \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux \cdot ux\right) \cdot \left(-1 + \frac{2}{ux}\right)}
                \end{array}
                
                Derivation
                1. Initial program 58.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 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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                      \[\leadsto \sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} + -1\right)} \cdot \left(2 \cdot \left(uy \cdot \pi\right)\right) \]
                    2. Final simplification76.9%

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

                    Alternative 14: 77.3% accurate, 4.6× speedup?

                    \[\begin{array}{l} \\ \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)} \end{array} \]
                    (FPCore (ux uy maxCos)
                     :precision binary32
                     (* (* 2.0 (* uy PI)) (sqrt (* ux (- 2.0 ux)))))
                    float code(float ux, float uy, float maxCos) {
                    	return (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * (2.0f - ux)));
                    }
                    
                    function code(ux, uy, maxCos)
                    	return Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))))
                    end
                    
                    function tmp = code(ux, uy, maxCos)
                    	tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * (single(2.0) - ux)));
                    end
                    
                    \begin{array}{l}
                    
                    \\
                    \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}
                    \end{array}
                    
                    Derivation
                    1. Initial program 58.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 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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 15: 63.7% accurate, 5.0× speedup?

                        \[\begin{array}{l} \\ \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot 2} \end{array} \]
                        (FPCore (ux uy maxCos)
                         :precision binary32
                         (* (* 2.0 (* uy PI)) (sqrt (* ux 2.0))))
                        float code(float ux, float uy, float maxCos) {
                        	return (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * 2.0f));
                        }
                        
                        function code(ux, uy, maxCos)
                        	return Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(2.0))))
                        end
                        
                        function tmp = code(ux, uy, maxCos)
                        	tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * single(2.0)));
                        end
                        
                        \begin{array}{l}
                        
                        \\
                        \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot 2}
                        \end{array}
                        
                        Derivation
                        1. Initial program 58.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 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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                            Reproduce

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