UniformSampleCone, y

Percentage Accurate: 57.8% → 98.5%
Time: 16.4s
Alternatives: 16
Speedup: 4.6×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 57.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(t\_0, t\_0, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 56.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.4% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.6% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 96.9% accurate, 1.1× speedup?

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

      1. Initial program 56.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \color{blue}{\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)} \]
      10. 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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\right)\right)} \]
      11. 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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\right)\right)} \]
        13. lower-PI.f3298.7

          \[\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)} \]
      12. Applied rewrites98.7%

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

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

      1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;uy \cdot 2 \leq 0.006000000052154064:\\ \;\;\;\;\sqrt{ux \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\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)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \end{array} \]
      13. Add Preprocessing

      Alternative 6: 88.9% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \color{blue}{\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)} \]
      10. 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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\right)\right)} \]
      11. 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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(\mathsf{neg}\left(ux\right), maxCos, ux\right)\right)} \]
        13. lower-PI.f3291.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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)} \]
      12. Applied rewrites91.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(\sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \sqrt{\mathsf{fma}\left(maxCos, -2, 2\right)}, \left(maxCos + -1\right) \cdot \mathsf{fma}\left(-ux, maxCos, ux\right)\right)} \]
      13. Final simplification91.1%

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

      Alternative 7: 88.8% accurate, 1.9× speedup?

      \[\begin{array}{l} \\ \sqrt{ux \cdot \left(2 + \mathsf{fma}\left(-ux, \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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
          (+ 2.0 (fma (- ux) (* (+ maxCos -1.0) (+ maxCos -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 * (2.0f + fmaf(-ux, ((maxCos + -1.0f) * (maxCos + -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 * Float32(Float32(2.0) + fma(Float32(-ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(maxCos + Float32(-1.0))), Float32(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 \left(2 + \mathsf{fma}\left(-ux, \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 56.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + \mathsf{fma}\left(-ux, \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -2\right)\right)}} \]
      9. 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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -2\right)\right)} \]
      10. 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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -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 \left(2 + \mathsf{fma}\left(\mathsf{neg}\left(ux\right), \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -2\right)\right)} \]
        13. lower-PI.f3291.0

          \[\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 \left(2 + \mathsf{fma}\left(-ux, \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -2\right)\right)} \]
      11. Applied rewrites91.0%

        \[\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 \left(2 + \mathsf{fma}\left(-ux, \left(maxCos + -1\right) \cdot \left(maxCos + -1\right), maxCos \cdot -2\right)\right)} \]
      12. Final simplification91.0%

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

      Alternative 8: 88.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\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(ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \]
      10. Applied rewrites91.0%

        \[\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(ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \]
      11. Add Preprocessing

      Alternative 9: 88.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 10: 81.0% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 11: 81.0% accurate, 2.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 12: 81.0% accurate, 3.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 13: 80.5% accurate, 3.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 14: 80.0% accurate, 3.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 15: 76.6% accurate, 4.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 16: 76.6% accurate, 4.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              Reproduce

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