UniformSampleCone, y

Percentage Accurate: 57.6% → 98.3%
Time: 19.2s
Alternatives: 22
Speedup: 5.0×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 22 alternatives:

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

Initial Program: 57.6% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.0% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% 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 60.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
    10. *-lft-identity60.0

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\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. lower-*.f3298.0

      \[\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}{-2 \cdot maxCos}\right)\right)} \]
  7. Simplified98.0%

    \[\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), -2 \cdot maxCos\right)\right)}} \]
  8. Final simplification98.0%

    \[\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), maxCos \cdot -2\right)\right)} \]
  9. Add Preprocessing

Alternative 5: 97.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(ux \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \sqrt{\frac{\color{blue}{2}}{ux} + -1} \]
      13. lower-/.f3290.9

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

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

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

Alternative 6: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), \mathsf{fma}\left(maxCos, -2, 2\right)\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 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 sinf(((uy * 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(sin(Float32(Float32(uy * 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}

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in ux around 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. Simplified98.0%

    \[\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. Add Preprocessing

Alternative 7: 97.0% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 58.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 maxCos around 0

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

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

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

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

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

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

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

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

Alternative 8: 96.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)\right)}\\ \mathbf{if}\;uy \cdot 2 \leq 0.052000001072883606:\\ \;\;\;\;uy \cdot \mathsf{fma}\left(2, \pi \cdot t\_0, t\_0 \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\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
           (* ux ux)
           (* (+ maxCos -1.0) (- 1.0 maxCos))
           (* ux (fma -2.0 maxCos 2.0))))))
   (if (<= (* uy 2.0) 0.052000001072883606)
     (*
      uy
      (fma
       2.0
       (* PI t_0)
       (* t_0 (* (* -1.3333333333333333 (* uy uy)) (* PI (* PI PI))))))
     (* (sin (* (* uy 2.0) PI)) (sqrt (* ux (- 2.0 ux)))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = sqrtf(fmaf((ux * ux), ((maxCos + -1.0f) * (1.0f - maxCos)), (ux * fmaf(-2.0f, maxCos, 2.0f))));
	float tmp;
	if ((uy * 2.0f) <= 0.052000001072883606f) {
		tmp = uy * fmaf(2.0f, (((float) M_PI) * t_0), (t_0 * ((-1.3333333333333333f * (uy * uy)) * (((float) M_PI) * (((float) M_PI) * ((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(Float32(ux * ux), Float32(Float32(maxCos + Float32(-1.0)) * Float32(Float32(1.0) - maxCos)), Float32(ux * fma(Float32(-2.0), maxCos, Float32(2.0)))))
	tmp = Float32(0.0)
	if (Float32(uy * Float32(2.0)) <= Float32(0.052000001072883606))
		tmp = Float32(uy * fma(Float32(2.0), Float32(Float32(pi) * t_0), Float32(t_0 * Float32(Float32(Float32(-1.3333333333333333) * Float32(uy * uy)) * Float32(Float32(pi) * Float32(Float32(pi) * 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(ux \cdot ux, \left(maxCos + -1\right) \cdot \left(1 - maxCos\right), ux \cdot \mathsf{fma}\left(-2, maxCos, 2\right)\right)}\\
\mathbf{if}\;uy \cdot 2 \leq 0.052000001072883606:\\
\;\;\;\;uy \cdot \mathsf{fma}\left(2, \pi \cdot t\_0, t\_0 \cdot \left(\left(-1.3333333333333333 \cdot \left(uy \cdot uy\right)\right) \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\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.0520000011

    1. Initial program 60.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -1 \cdot ux\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 + \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}\right)} \]
      9. unsub-negN/A

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 - ux\right)}} \]
      10. lower--.f3291.2

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

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

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

Alternative 9: 93.7% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 55.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 93.7% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 55.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 89.2% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 89.2% accurate, 1.7× 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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (* uy (fma -1.3333333333333333 (* (* uy uy) (* PI (* PI PI))) (* 2.0 PI)))
  (sqrt
   (*
    (* ux ux)
    (fma (+ maxCos -1.0) (- 1.0 maxCos) (/ (fma maxCos -2.0 2.0) ux))))))
float code(float ux, float uy, float maxCos) {
	return (uy * fmaf(-1.3333333333333333f, ((uy * uy) * (((float) M_PI) * (((float) M_PI) * ((float) M_PI)))), (2.0f * ((float) M_PI)))) * sqrtf(((ux * ux) * fmaf((maxCos + -1.0f), (1.0f - maxCos), (fmaf(maxCos, -2.0f, 2.0f) / ux))));
}
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(Float32(ux * ux) * fma(Float32(maxCos + Float32(-1.0)), Float32(Float32(1.0) - maxCos), Float32(fma(maxCos, Float32(-2.0), Float32(2.0)) / ux)))))
end
\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)}
\end{array}
Derivation
  1. Initial program 60.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
    2. lower-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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
    3. lower-*.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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
    13. lower-PI.f3290.5

      \[\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{\left(ux \cdot ux\right) \cdot \mathsf{fma}\left(maxCos + -1, 1 - maxCos, \frac{\mathsf{fma}\left(maxCos, -2, 2\right)}{ux}\right)} \]
  8. Simplified90.5%

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

Alternative 13: 87.9% accurate, 2.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux - \mathsf{fma}\left(ux, \left(maxCos + -1\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1\right) - ux\right), maxCos \cdot ux\right)}\right)\right)\\


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      10. *-lft-identity58.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
      14. lower-PI.f3255.4

        \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    10. Simplified55.4%

      \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    11. Applied egg-rr90.0%

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

    if 9.99999997e-7 < maxCos

    1. Initial program 65.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Applied egg-rr60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 87.9% accurate, 2.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux - \mathsf{fma}\left(ux, \left(maxCos + -1\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1\right) - ux\right), maxCos \cdot ux\right)}\right)\right)\\


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      10. *-lft-identity58.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
      14. lower-PI.f3255.4

        \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    10. Simplified55.4%

      \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    11. Applied egg-rr90.0%

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

    if 9.99999997e-7 < maxCos

    1. Initial program 65.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Applied egg-rr60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 87.9% accurate, 2.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux - \mathsf{fma}\left(ux, \left(maxCos + -1\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1\right) - ux\right), maxCos \cdot ux\right)}\right)\right)\\


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)}} \]
      10. *-lft-identity58.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
      14. lower-PI.f3255.4

        \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    10. Simplified55.4%

      \[\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{1 - \left(\left(\frac{1}{ux + 1} - \frac{ux \cdot ux}{ux + 1}\right) - ux \cdot \left(1 - ux\right)\right)} \]
    11. Taylor expanded in ux around 0

      \[\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), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -1 \cdot ux\right)}} \]
    12. Step-by-step derivation
      1. 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), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 + -1 \cdot ux\right)}} \]
      2. mul-1-negN/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), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \left(2 + \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)}\right)} \]
      3. unsub-negN/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), 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 - ux\right)}} \]
      4. lower--.f3289.9

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

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

    if 9.99999997e-7 < maxCos

    1. Initial program 65.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Applied egg-rr60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 81.3% accurate, 2.7× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 81.3% accurate, 2.7× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr54.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 77.0% accurate, 4.2× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr53.8%

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

    \[\leadsto \color{blue}{2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux - -1 \cdot \left(ux \cdot \left(1 - ux\right)\right)}\right)} \]
  8. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

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

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

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

      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux - \color{blue}{\left(\mathsf{neg}\left(ux\right)\right)} \cdot \left(1 - ux\right)} \]
    9. cancel-sign-subN/A

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

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

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

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

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

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

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

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

      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux + \left(ux + \left(\mathsf{neg}\left(\color{blue}{{ux}^{2}}\right)\right)\right)} \]
    18. unsub-negN/A

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

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

      \[\leadsto \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{ux + \left(ux - \color{blue}{ux \cdot ux}\right)} \]
    21. lower-*.f3277.9

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

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

Alternative 19: 65.8% accurate, 4.2× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(\left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right)} \]
    10. lower-*.f3265.9

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

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

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

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

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

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

Alternative 20: 65.8% accurate, 4.2× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr53.8%

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

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

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

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

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

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

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

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

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

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

Alternative 21: 63.2% accurate, 5.0× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr53.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{2 \cdot ux}}\right) \]
  11. Step-by-step derivation
    1. lower-*.f3262.6

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

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

Alternative 22: 7.1% accurate, 5.4× speedup?

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

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in 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. Simplified53.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. Applied egg-rr54.2%

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

    \[\leadsto 2 \cdot \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{1}}\right) \]
  8. Step-by-step derivation
    1. Simplified7.1%

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

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

    Reproduce

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