UniformSampleCone, y

Percentage Accurate: 57.4% → 98.2%
Time: 12.8s
Alternatives: 9
Speedup: N/A×

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 9 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.4% 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.2% accurate, N/A× speedup?

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

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

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\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. *-commutativeN/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    6. lower-/.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    7. *-commutativeN/A

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

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, N/A× speedup?

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

\\
\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 - ux \cdot {\left(maxCos - 1\right)}^{2}}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\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. *-commutativeN/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    6. lower-/.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    7. *-commutativeN/A

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\frac{\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos}{ux} \cdot \left(\color{blue}{ux} \cdot ux\right)} \]
  7. Step-by-step derivation
    1. div-subN/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)} \]
    2. lower--.f32N/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)} \]
    7. lift-pow.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)} \]
    8. lift--.f32N/A

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)} \]
    10. lower-*.f3298.2

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} - \frac{2 \cdot maxCos}{ux}\right) \cdot \left(ux \cdot ux\right)} \]
  8. Applied rewrites98.2%

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

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

Alternative 3: 95.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - 2 \cdot maxCos\\ t_1 := ux \cdot t\_0\\ t_2 := {t\_1}^{0.5}\\ t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ \mathsf{fma}\left(t\_2, t\_3, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{t\_2} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (- 2.0 (* 2.0 maxCos)))
        (t_1 (* ux t_0))
        (t_2 (pow t_1 0.5))
        (t_3 (sin (* 2.0 (* uy PI)))))
   (fma
    t_2
    t_3
    (*
     (* ux ux)
     (+
      (* -0.5 (* (/ 1.0 t_2) (* t_3 (pow (- maxCos 1.0) 2.0))))
      (*
       (* ux ux)
       (fma
        -0.125
        (* (pow (/ 1.0 (pow t_1 3.0)) 0.5) (* t_3 (pow (- maxCos 1.0) 4.0)))
        (*
         -0.0625
         (*
          (pow (/ 1.0 (* ux (pow t_0 5.0))) 0.5)
          (* t_3 (pow (- maxCos 1.0) 6.0)))))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 2.0f - (2.0f * maxCos);
	float t_1 = ux * t_0;
	float t_2 = powf(t_1, 0.5f);
	float t_3 = sinf((2.0f * (uy * ((float) M_PI))));
	return fmaf(t_2, t_3, ((ux * ux) * ((-0.5f * ((1.0f / t_2) * (t_3 * powf((maxCos - 1.0f), 2.0f)))) + ((ux * ux) * fmaf(-0.125f, (powf((1.0f / powf(t_1, 3.0f)), 0.5f) * (t_3 * powf((maxCos - 1.0f), 4.0f))), (-0.0625f * (powf((1.0f / (ux * powf(t_0, 5.0f))), 0.5f) * (t_3 * powf((maxCos - 1.0f), 6.0f)))))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos))
	t_1 = Float32(ux * t_0)
	t_2 = t_1 ^ Float32(0.5)
	t_3 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	return fma(t_2, t_3, Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * Float32(Float32(Float32(1.0) / t_2) * Float32(t_3 * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) + Float32(Float32(ux * ux) * fma(Float32(-0.125), Float32((Float32(Float32(1.0) / (t_1 ^ Float32(3.0))) ^ Float32(0.5)) * Float32(t_3 * (Float32(maxCos - Float32(1.0)) ^ Float32(4.0)))), Float32(Float32(-0.0625) * Float32((Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(5.0)))) ^ Float32(0.5)) * Float32(t_3 * (Float32(maxCos - Float32(1.0)) ^ Float32(6.0))))))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - 2 \cdot maxCos\\
t_1 := ux \cdot t\_0\\
t_2 := {t\_1}^{0.5}\\
t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
\mathsf{fma}\left(t\_2, t\_3, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{t\_2} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\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. *-commutativeN/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    6. lower-/.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    7. *-commutativeN/A

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  7. Applied rewrites96.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right)} \]
  8. Add Preprocessing

Alternative 4: 95.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - 2 \cdot maxCos\\ t_1 := ux \cdot t\_0\\ t_2 := {t\_1}^{0.5}\\ t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ \mathsf{fma}\left(t\_2, t\_3, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{t\_2} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (- 2.0 (* 2.0 maxCos)))
        (t_1 (* ux t_0))
        (t_2 (pow t_1 0.5))
        (t_3 (sin (* 2.0 (* uy PI)))))
   (fma
    t_2
    t_3
    (*
     (* ux ux)
     (+
      (* -0.5 (* (/ 1.0 t_2) (* t_3 (pow (- maxCos 1.0) 2.0))))
      (*
       (* ux ux)
       (fma
        -0.125
        (*
         (pow (/ 1.0 (pow t_1 3.0)) 0.5)
         (*
          (*
           uy
           (fma -1.3333333333333333 (* (pow uy 2.0) (pow PI 3.0)) (* 2.0 PI)))
          (pow (- maxCos 1.0) 4.0)))
        (*
         -0.0625
         (*
          (pow (/ 1.0 (* ux (pow t_0 5.0))) 0.5)
          (* t_3 (pow (- maxCos 1.0) 6.0)))))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 2.0f - (2.0f * maxCos);
	float t_1 = ux * t_0;
	float t_2 = powf(t_1, 0.5f);
	float t_3 = sinf((2.0f * (uy * ((float) M_PI))));
	return fmaf(t_2, t_3, ((ux * ux) * ((-0.5f * ((1.0f / t_2) * (t_3 * powf((maxCos - 1.0f), 2.0f)))) + ((ux * ux) * fmaf(-0.125f, (powf((1.0f / powf(t_1, 3.0f)), 0.5f) * ((uy * fmaf(-1.3333333333333333f, (powf(uy, 2.0f) * powf(((float) M_PI), 3.0f)), (2.0f * ((float) M_PI)))) * powf((maxCos - 1.0f), 4.0f))), (-0.0625f * (powf((1.0f / (ux * powf(t_0, 5.0f))), 0.5f) * (t_3 * powf((maxCos - 1.0f), 6.0f)))))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos))
	t_1 = Float32(ux * t_0)
	t_2 = t_1 ^ Float32(0.5)
	t_3 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	return fma(t_2, t_3, Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * Float32(Float32(Float32(1.0) / t_2) * Float32(t_3 * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) + Float32(Float32(ux * ux) * fma(Float32(-0.125), Float32((Float32(Float32(1.0) / (t_1 ^ Float32(3.0))) ^ Float32(0.5)) * Float32(Float32(uy * fma(Float32(-1.3333333333333333), Float32((uy ^ Float32(2.0)) * (Float32(pi) ^ Float32(3.0))), Float32(Float32(2.0) * Float32(pi)))) * (Float32(maxCos - Float32(1.0)) ^ Float32(4.0)))), Float32(Float32(-0.0625) * Float32((Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(5.0)))) ^ Float32(0.5)) * Float32(t_3 * (Float32(maxCos - Float32(1.0)) ^ Float32(6.0))))))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - 2 \cdot maxCos\\
t_1 := ux \cdot t\_0\\
t_2 := {t\_1}^{0.5}\\
t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
\mathsf{fma}\left(t\_2, t\_3, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{t\_2} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5} \cdot \left(t\_3 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\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. *-commutativeN/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    6. lower-/.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    7. *-commutativeN/A

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  7. Applied rewrites96.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right)} \]
  8. Taylor expanded in uy around 0

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

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\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 {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    2. lower-fma.f32N/A

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

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    4. lower-pow.f32N/A

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    5. lift-pow.f32N/A

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    6. lift-PI.f32N/A

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    7. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(\frac{-1}{8}, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{\frac{1}{2}} \cdot \left(\left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \frac{-1}{16} \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{\frac{1}{2}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
    8. lift-PI.f3296.5

      \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
  10. Applied rewrites96.5%

    \[\leadsto \mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\left(uy \cdot \mathsf{fma}\left(-1.3333333333333333, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right) \]
  11. Add Preprocessing

Alternative 5: 94.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - 2 \cdot maxCos\\ t_1 := ux \cdot t\_0\\ t_2 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ t_3 := {\left(maxCos - 1\right)}^{4}\\ t_4 := {\left(maxCos - 1\right)}^{2}\\ t_5 := {\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5}\\ t_6 := \left(1 - ux\right) + ux \cdot maxCos\\ t_7 := {\left(maxCos - 1\right)}^{6}\\ \mathbf{if}\;t\_6 \cdot t\_6 \leq 0.9999939799308777:\\ \;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-0.5, \sqrt{\frac{1}{{ux}^{5} \cdot t\_0}} \cdot \left(t\_2 \cdot t\_4\right), \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(t\_2 \cdot t\_3\right), \mathsf{fma}\left(-0.0625, t\_5 \cdot \left(t\_2 \cdot t\_7\right), \sqrt{\frac{t\_0}{{ux}^{7}}} \cdot t\_2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{t\_0}{{ux}^{3}}} \cdot \left(t\_2 \cdot -1\right), -0.5 \cdot \left(\frac{1}{{t\_1}^{0.5}} \cdot \left(t\_2 \cdot \left(-1 \cdot t\_4\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{3}}\right)}^{0.5} \cdot \left(t\_2 \cdot \left(-1 \cdot t\_3\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left(t\_5 \cdot \left(t\_2 \cdot \left(-1 \cdot t\_7\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (- 2.0 (* 2.0 maxCos)))
        (t_1 (* ux t_0))
        (t_2 (sin (* 2.0 (* uy PI))))
        (t_3 (pow (- maxCos 1.0) 4.0))
        (t_4 (pow (- maxCos 1.0) 2.0))
        (t_5 (pow (/ 1.0 (* ux (pow t_0 5.0))) 0.5))
        (t_6 (+ (- 1.0 ux) (* ux maxCos)))
        (t_7 (pow (- maxCos 1.0) 6.0)))
   (if (<= (* t_6 t_6) 0.9999939799308777)
     (*
      (pow ux 4.0)
      (fma
       -0.5
       (* (sqrt (/ 1.0 (* (pow ux 5.0) t_0))) (* t_2 t_4))
       (fma
        -0.125
        (* (pow (/ 1.0 (pow t_1 3.0)) 0.5) (* t_2 t_3))
        (fma
         -0.0625
         (* t_5 (* t_2 t_7))
         (* (sqrt (/ t_0 (pow ux 7.0))) t_2)))))
     (*
      (pow ux 4.0)
      (fma
       -1.0
       (/
        (fma
         -1.0
         (/
          (fma
           -1.0
           (* (sqrt (/ t_0 (pow ux 3.0))) (* t_2 -1.0))
           (* -0.5 (* (/ 1.0 (pow t_1 0.5)) (* t_2 (* -1.0 t_4)))))
          ux)
         (*
          -0.125
          (* (pow (/ 1.0 (* ux (pow t_0 3.0))) 0.5) (* t_2 (* -1.0 t_3)))))
        ux)
       (* -0.0625 (* t_5 (* t_2 (* -1.0 t_7)))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 2.0f - (2.0f * maxCos);
	float t_1 = ux * t_0;
	float t_2 = sinf((2.0f * (uy * ((float) M_PI))));
	float t_3 = powf((maxCos - 1.0f), 4.0f);
	float t_4 = powf((maxCos - 1.0f), 2.0f);
	float t_5 = powf((1.0f / (ux * powf(t_0, 5.0f))), 0.5f);
	float t_6 = (1.0f - ux) + (ux * maxCos);
	float t_7 = powf((maxCos - 1.0f), 6.0f);
	float tmp;
	if ((t_6 * t_6) <= 0.9999939799308777f) {
		tmp = powf(ux, 4.0f) * fmaf(-0.5f, (sqrtf((1.0f / (powf(ux, 5.0f) * t_0))) * (t_2 * t_4)), fmaf(-0.125f, (powf((1.0f / powf(t_1, 3.0f)), 0.5f) * (t_2 * t_3)), fmaf(-0.0625f, (t_5 * (t_2 * t_7)), (sqrtf((t_0 / powf(ux, 7.0f))) * t_2))));
	} else {
		tmp = powf(ux, 4.0f) * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(-1.0f, (sqrtf((t_0 / powf(ux, 3.0f))) * (t_2 * -1.0f)), (-0.5f * ((1.0f / powf(t_1, 0.5f)) * (t_2 * (-1.0f * t_4))))) / ux), (-0.125f * (powf((1.0f / (ux * powf(t_0, 3.0f))), 0.5f) * (t_2 * (-1.0f * t_3))))) / ux), (-0.0625f * (t_5 * (t_2 * (-1.0f * t_7)))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos))
	t_1 = Float32(ux * t_0)
	t_2 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	t_3 = Float32(maxCos - Float32(1.0)) ^ Float32(4.0)
	t_4 = Float32(maxCos - Float32(1.0)) ^ Float32(2.0)
	t_5 = Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(5.0)))) ^ Float32(0.5)
	t_6 = Float32(Float32(Float32(1.0) - ux) + Float32(ux * maxCos))
	t_7 = Float32(maxCos - Float32(1.0)) ^ Float32(6.0)
	tmp = Float32(0.0)
	if (Float32(t_6 * t_6) <= Float32(0.9999939799308777))
		tmp = Float32((ux ^ Float32(4.0)) * fma(Float32(-0.5), Float32(sqrt(Float32(Float32(1.0) / Float32((ux ^ Float32(5.0)) * t_0))) * Float32(t_2 * t_4)), fma(Float32(-0.125), Float32((Float32(Float32(1.0) / (t_1 ^ Float32(3.0))) ^ Float32(0.5)) * Float32(t_2 * t_3)), fma(Float32(-0.0625), Float32(t_5 * Float32(t_2 * t_7)), Float32(sqrt(Float32(t_0 / (ux ^ Float32(7.0)))) * t_2)))));
	else
		tmp = Float32((ux ^ Float32(4.0)) * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(sqrt(Float32(t_0 / (ux ^ Float32(3.0)))) * Float32(t_2 * Float32(-1.0))), Float32(Float32(-0.5) * Float32(Float32(Float32(1.0) / (t_1 ^ Float32(0.5))) * Float32(t_2 * Float32(Float32(-1.0) * t_4))))) / ux), Float32(Float32(-0.125) * Float32((Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(3.0)))) ^ Float32(0.5)) * Float32(t_2 * Float32(Float32(-1.0) * t_3))))) / ux), Float32(Float32(-0.0625) * Float32(t_5 * Float32(t_2 * Float32(Float32(-1.0) * t_7))))));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - 2 \cdot maxCos\\
t_1 := ux \cdot t\_0\\
t_2 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
t_3 := {\left(maxCos - 1\right)}^{4}\\
t_4 := {\left(maxCos - 1\right)}^{2}\\
t_5 := {\left(\frac{1}{ux \cdot {t\_0}^{5}}\right)}^{0.5}\\
t_6 := \left(1 - ux\right) + ux \cdot maxCos\\
t_7 := {\left(maxCos - 1\right)}^{6}\\
\mathbf{if}\;t\_6 \cdot t\_6 \leq 0.9999939799308777:\\
\;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-0.5, \sqrt{\frac{1}{{ux}^{5} \cdot t\_0}} \cdot \left(t\_2 \cdot t\_4\right), \mathsf{fma}\left(-0.125, {\left(\frac{1}{{t\_1}^{3}}\right)}^{0.5} \cdot \left(t\_2 \cdot t\_3\right), \mathsf{fma}\left(-0.0625, t\_5 \cdot \left(t\_2 \cdot t\_7\right), \sqrt{\frac{t\_0}{{ux}^{7}}} \cdot t\_2\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{t\_0}{{ux}^{3}}} \cdot \left(t\_2 \cdot -1\right), -0.5 \cdot \left(\frac{1}{{t\_1}^{0.5}} \cdot \left(t\_2 \cdot \left(-1 \cdot t\_4\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {t\_0}^{3}}\right)}^{0.5} \cdot \left(t\_2 \cdot \left(-1 \cdot t\_3\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left(t\_5 \cdot \left(t\_2 \cdot \left(-1 \cdot t\_7\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))) < 0.99999398

    1. Initial program 77.9%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
    5. Taylor expanded in ux around inf

      \[\leadsto {ux}^{4} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{{ux}^{5} \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \left(\frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right) + \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{7}}} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)} \]
    6. Applied rewrites95.2%

      \[\leadsto {ux}^{4} \cdot \color{blue}{\mathsf{fma}\left(-0.5, \sqrt{\frac{1}{{ux}^{5} \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right), \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), \mathsf{fma}\left(-0.0625, {\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right), \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{7}}} \cdot \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\right)\right)\right)} \]

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
    5. Taylor expanded in ux around -inf

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

      \[\leadsto {ux}^{4} \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot -1\right), -0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 94.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{{ux}^{3}}\\ t_1 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ t_2 := \sqrt{{ux}^{3}}\\ t_3 := {\left(\sqrt{0.5}\right)}^{2}\\ t_4 := \sqrt{\frac{1}{ux}}\\ t_5 := t\_4 \cdot \frac{t\_1}{\sqrt{0.03125}}\\ t_6 := t\_4 \cdot \left(t\_1 \cdot \sqrt{0.5}\right)\\ t_7 := t\_4 \cdot \frac{t\_1}{\sqrt{0.5}}\\ t_8 := \sqrt{t\_0}\\ t_9 := t\_8 \cdot \left(t\_1 \cdot \sqrt{0.125}\right)\\ t_10 := t\_8 \cdot \frac{t\_1}{\sqrt{0.125}}\\ t_11 := 0.5 \cdot \frac{1}{ux}\\ t_12 := t\_11 - 0.0625 \cdot \frac{1}{ux \cdot t\_3}\\ t_13 := \sqrt{ux} \cdot \frac{t\_1 \cdot t\_12}{\sqrt{0.5}}\\ t_14 := {\left(\sqrt{0.125}\right)}^{2}\\ t_15 := 0.75 \cdot t\_0 - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot t\_14}\\ t_16 := t\_2 \cdot \frac{t\_1 \cdot t\_15}{\sqrt{0.125}}\\ t_17 := t\_4 \cdot \left(t\_1 \cdot \sqrt{0.03125}\right)\\ t_18 := {\left(\sqrt{0.03125}\right)}^{2}\\ t_19 := 0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot t\_18}\\ t_20 := \sqrt{ux} \cdot \frac{t\_1 \cdot t\_19}{\sqrt{0.03125}}\\ \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{t\_1}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_1}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_1}{{\left(\sqrt{2}\right)}^{5}}, {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-1, t\_13, \mathsf{fma}\left(0.25, t\_7, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{t\_1 \cdot \left(t\_11 + \left(-1 \cdot 0.25\right) \cdot \frac{t\_12}{t\_3}\right)}{\sqrt{0.5}}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_9, \mathsf{fma}\left(-2, t\_16, \mathsf{fma}\left(0.5, t\_2 \cdot \frac{t\_1 \cdot \left(1.25 \cdot t\_0 - 0.1875 \cdot \frac{t\_15}{t\_14}\right)}{\sqrt{0.125}}, 1.125 \cdot t\_10\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, t\_17, \mathsf{fma}\left(-3, t\_20, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{t\_1 \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \frac{t\_19}{t\_18}\right)}{\sqrt{0.03125}}, 1.171875 \cdot t\_5\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-0.5, t\_7, \mathsf{fma}\left(0.5, t\_13, t\_6\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, t\_10, \mathsf{fma}\left(0.5, t\_16, 6 \cdot t\_9\right)\right), -0.0625 \cdot \left(-0.46875 \cdot t\_5 + \mathsf{fma}\left(0.5, t\_20, 15 \cdot t\_17\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, t\_6, 0.25 \cdot t\_7\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_9, 0.1875 \cdot t\_10\right), -0.0625 \cdot \mathsf{fma}\left(-6, t\_17, 0.078125 \cdot t\_5\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, t\_1 \cdot \sqrt{2}, {ux}^{2} \cdot \left(-0.5 \cdot t\_6 + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, t\_9, -0.0625 \cdot t\_17\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (/ 1.0 (pow ux 3.0)))
        (t_1 (sin (* 2.0 (* uy PI))))
        (t_2 (sqrt (pow ux 3.0)))
        (t_3 (pow (sqrt 0.5) 2.0))
        (t_4 (sqrt (/ 1.0 ux)))
        (t_5 (* t_4 (/ t_1 (sqrt 0.03125))))
        (t_6 (* t_4 (* t_1 (sqrt 0.5))))
        (t_7 (* t_4 (/ t_1 (sqrt 0.5))))
        (t_8 (sqrt t_0))
        (t_9 (* t_8 (* t_1 (sqrt 0.125))))
        (t_10 (* t_8 (/ t_1 (sqrt 0.125))))
        (t_11 (* 0.5 (/ 1.0 ux)))
        (t_12 (- t_11 (* 0.0625 (/ 1.0 (* ux t_3)))))
        (t_13 (* (sqrt ux) (/ (* t_1 t_12) (sqrt 0.5))))
        (t_14 (pow (sqrt 0.125) 2.0))
        (t_15 (- (* 0.75 t_0) (* 0.03515625 (/ 1.0 (* (pow ux 3.0) t_14)))))
        (t_16 (* t_2 (/ (* t_1 t_15) (sqrt 0.125))))
        (t_17 (* t_4 (* t_1 (sqrt 0.03125))))
        (t_18 (pow (sqrt 0.03125) 2.0))
        (t_19
         (- (* 0.46875 (/ 1.0 ux)) (* 0.006103515625 (/ 1.0 (* ux t_18)))))
        (t_20 (* (sqrt ux) (/ (* t_1 t_19) (sqrt 0.03125)))))
   (fma
    maxCos
    (fma
     -1.0
     (* (sqrt ux) (/ t_1 (sqrt 2.0)))
     (fma
      maxCos
      (fma
       -0.5
       (* (sqrt ux) (/ t_1 (pow (sqrt 2.0) 3.0)))
       (fma
        maxCos
        (fma
         -0.5
         (* (sqrt ux) (/ t_1 (pow (sqrt 2.0) 5.0)))
         (*
          (pow ux 2.0)
          (fma
           -0.5
           (fma
            -1.0
            t_13
            (fma
             0.25
             t_7
             (*
              0.5
              (*
               (sqrt ux)
               (/
                (* t_1 (+ t_11 (* (* -1.0 0.25) (/ t_12 t_3))))
                (sqrt 0.5))))))
           (*
            (pow ux 2.0)
            (fma
             -0.125
             (fma
              -4.0
              t_9
              (fma
               -2.0
               t_16
               (fma
                0.5
                (*
                 t_2
                 (/
                  (* t_1 (- (* 1.25 t_0) (* 0.1875 (/ t_15 t_14))))
                  (sqrt 0.125)))
                (* 1.125 t_10))))
             (*
              -0.0625
              (fma
               -20.0
               t_17
               (fma
                -3.0
                t_20
                (fma
                 0.5
                 (*
                  (sqrt ux)
                  (/
                   (*
                    t_1
                    (+
                     (* 1.09375 (/ 1.0 ux))
                     (* (* -1.0 0.078125) (/ t_19 t_18))))
                   (sqrt 0.03125)))
                 (* 1.171875 t_5))))))))))
        (*
         (pow ux 2.0)
         (fma
          -0.5
          (fma -0.5 t_7 (fma 0.5 t_13 t_6))
          (*
           (pow ux 2.0)
           (fma
            -0.125
            (fma -0.75 t_10 (fma 0.5 t_16 (* 6.0 t_9)))
            (* -0.0625 (+ (* -0.46875 t_5) (fma 0.5 t_20 (* 15.0 t_17))))))))))
      (*
       (pow ux 2.0)
       (+
        (* -0.5 (fma -2.0 t_6 (* 0.25 t_7)))
        (*
         (pow ux 2.0)
         (fma
          -0.125
          (fma -4.0 t_9 (* 0.1875 t_10))
          (* -0.0625 (fma -6.0 t_17 (* 0.078125 t_5)))))))))
    (fma
     (sqrt ux)
     (* t_1 (sqrt 2.0))
     (*
      (pow ux 2.0)
      (+ (* -0.5 t_6) (* (pow ux 2.0) (fma -0.125 t_9 (* -0.0625 t_17)))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 1.0f / powf(ux, 3.0f);
	float t_1 = sinf((2.0f * (uy * ((float) M_PI))));
	float t_2 = sqrtf(powf(ux, 3.0f));
	float t_3 = powf(sqrtf(0.5f), 2.0f);
	float t_4 = sqrtf((1.0f / ux));
	float t_5 = t_4 * (t_1 / sqrtf(0.03125f));
	float t_6 = t_4 * (t_1 * sqrtf(0.5f));
	float t_7 = t_4 * (t_1 / sqrtf(0.5f));
	float t_8 = sqrtf(t_0);
	float t_9 = t_8 * (t_1 * sqrtf(0.125f));
	float t_10 = t_8 * (t_1 / sqrtf(0.125f));
	float t_11 = 0.5f * (1.0f / ux);
	float t_12 = t_11 - (0.0625f * (1.0f / (ux * t_3)));
	float t_13 = sqrtf(ux) * ((t_1 * t_12) / sqrtf(0.5f));
	float t_14 = powf(sqrtf(0.125f), 2.0f);
	float t_15 = (0.75f * t_0) - (0.03515625f * (1.0f / (powf(ux, 3.0f) * t_14)));
	float t_16 = t_2 * ((t_1 * t_15) / sqrtf(0.125f));
	float t_17 = t_4 * (t_1 * sqrtf(0.03125f));
	float t_18 = powf(sqrtf(0.03125f), 2.0f);
	float t_19 = (0.46875f * (1.0f / ux)) - (0.006103515625f * (1.0f / (ux * t_18)));
	float t_20 = sqrtf(ux) * ((t_1 * t_19) / sqrtf(0.03125f));
	return fmaf(maxCos, fmaf(-1.0f, (sqrtf(ux) * (t_1 / sqrtf(2.0f))), fmaf(maxCos, fmaf(-0.5f, (sqrtf(ux) * (t_1 / powf(sqrtf(2.0f), 3.0f))), fmaf(maxCos, fmaf(-0.5f, (sqrtf(ux) * (t_1 / powf(sqrtf(2.0f), 5.0f))), (powf(ux, 2.0f) * fmaf(-0.5f, fmaf(-1.0f, t_13, fmaf(0.25f, t_7, (0.5f * (sqrtf(ux) * ((t_1 * (t_11 + ((-1.0f * 0.25f) * (t_12 / t_3)))) / sqrtf(0.5f)))))), (powf(ux, 2.0f) * fmaf(-0.125f, fmaf(-4.0f, t_9, fmaf(-2.0f, t_16, fmaf(0.5f, (t_2 * ((t_1 * ((1.25f * t_0) - (0.1875f * (t_15 / t_14)))) / sqrtf(0.125f))), (1.125f * t_10)))), (-0.0625f * fmaf(-20.0f, t_17, fmaf(-3.0f, t_20, fmaf(0.5f, (sqrtf(ux) * ((t_1 * ((1.09375f * (1.0f / ux)) + ((-1.0f * 0.078125f) * (t_19 / t_18)))) / sqrtf(0.03125f))), (1.171875f * t_5)))))))))), (powf(ux, 2.0f) * fmaf(-0.5f, fmaf(-0.5f, t_7, fmaf(0.5f, t_13, t_6)), (powf(ux, 2.0f) * fmaf(-0.125f, fmaf(-0.75f, t_10, fmaf(0.5f, t_16, (6.0f * t_9))), (-0.0625f * ((-0.46875f * t_5) + fmaf(0.5f, t_20, (15.0f * t_17)))))))))), (powf(ux, 2.0f) * ((-0.5f * fmaf(-2.0f, t_6, (0.25f * t_7))) + (powf(ux, 2.0f) * fmaf(-0.125f, fmaf(-4.0f, t_9, (0.1875f * t_10)), (-0.0625f * fmaf(-6.0f, t_17, (0.078125f * t_5))))))))), fmaf(sqrtf(ux), (t_1 * sqrtf(2.0f)), (powf(ux, 2.0f) * ((-0.5f * t_6) + (powf(ux, 2.0f) * fmaf(-0.125f, t_9, (-0.0625f * t_17)))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(1.0) / (ux ^ Float32(3.0)))
	t_1 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	t_2 = sqrt((ux ^ Float32(3.0)))
	t_3 = sqrt(Float32(0.5)) ^ Float32(2.0)
	t_4 = sqrt(Float32(Float32(1.0) / ux))
	t_5 = Float32(t_4 * Float32(t_1 / sqrt(Float32(0.03125))))
	t_6 = Float32(t_4 * Float32(t_1 * sqrt(Float32(0.5))))
	t_7 = Float32(t_4 * Float32(t_1 / sqrt(Float32(0.5))))
	t_8 = sqrt(t_0)
	t_9 = Float32(t_8 * Float32(t_1 * sqrt(Float32(0.125))))
	t_10 = Float32(t_8 * Float32(t_1 / sqrt(Float32(0.125))))
	t_11 = Float32(Float32(0.5) * Float32(Float32(1.0) / ux))
	t_12 = Float32(t_11 - Float32(Float32(0.0625) * Float32(Float32(1.0) / Float32(ux * t_3))))
	t_13 = Float32(sqrt(ux) * Float32(Float32(t_1 * t_12) / sqrt(Float32(0.5))))
	t_14 = sqrt(Float32(0.125)) ^ Float32(2.0)
	t_15 = Float32(Float32(Float32(0.75) * t_0) - Float32(Float32(0.03515625) * Float32(Float32(1.0) / Float32((ux ^ Float32(3.0)) * t_14))))
	t_16 = Float32(t_2 * Float32(Float32(t_1 * t_15) / sqrt(Float32(0.125))))
	t_17 = Float32(t_4 * Float32(t_1 * sqrt(Float32(0.03125))))
	t_18 = sqrt(Float32(0.03125)) ^ Float32(2.0)
	t_19 = Float32(Float32(Float32(0.46875) * Float32(Float32(1.0) / ux)) - Float32(Float32(0.006103515625) * Float32(Float32(1.0) / Float32(ux * t_18))))
	t_20 = Float32(sqrt(ux) * Float32(Float32(t_1 * t_19) / sqrt(Float32(0.03125))))
	return fma(maxCos, fma(Float32(-1.0), Float32(sqrt(ux) * Float32(t_1 / sqrt(Float32(2.0)))), fma(maxCos, fma(Float32(-0.5), Float32(sqrt(ux) * Float32(t_1 / (sqrt(Float32(2.0)) ^ Float32(3.0)))), fma(maxCos, fma(Float32(-0.5), Float32(sqrt(ux) * Float32(t_1 / (sqrt(Float32(2.0)) ^ Float32(5.0)))), Float32((ux ^ Float32(2.0)) * fma(Float32(-0.5), fma(Float32(-1.0), t_13, fma(Float32(0.25), t_7, Float32(Float32(0.5) * Float32(sqrt(ux) * Float32(Float32(t_1 * Float32(t_11 + Float32(Float32(Float32(-1.0) * Float32(0.25)) * Float32(t_12 / t_3)))) / sqrt(Float32(0.5))))))), Float32((ux ^ Float32(2.0)) * fma(Float32(-0.125), fma(Float32(-4.0), t_9, fma(Float32(-2.0), t_16, fma(Float32(0.5), Float32(t_2 * Float32(Float32(t_1 * Float32(Float32(Float32(1.25) * t_0) - Float32(Float32(0.1875) * Float32(t_15 / t_14)))) / sqrt(Float32(0.125)))), Float32(Float32(1.125) * t_10)))), Float32(Float32(-0.0625) * fma(Float32(-20.0), t_17, fma(Float32(-3.0), t_20, fma(Float32(0.5), Float32(sqrt(ux) * Float32(Float32(t_1 * Float32(Float32(Float32(1.09375) * Float32(Float32(1.0) / ux)) + Float32(Float32(Float32(-1.0) * Float32(0.078125)) * Float32(t_19 / t_18)))) / sqrt(Float32(0.03125)))), Float32(Float32(1.171875) * t_5)))))))))), Float32((ux ^ Float32(2.0)) * fma(Float32(-0.5), fma(Float32(-0.5), t_7, fma(Float32(0.5), t_13, t_6)), Float32((ux ^ Float32(2.0)) * fma(Float32(-0.125), fma(Float32(-0.75), t_10, fma(Float32(0.5), t_16, Float32(Float32(6.0) * t_9))), Float32(Float32(-0.0625) * Float32(Float32(Float32(-0.46875) * t_5) + fma(Float32(0.5), t_20, Float32(Float32(15.0) * t_17)))))))))), Float32((ux ^ Float32(2.0)) * Float32(Float32(Float32(-0.5) * fma(Float32(-2.0), t_6, Float32(Float32(0.25) * t_7))) + Float32((ux ^ Float32(2.0)) * fma(Float32(-0.125), fma(Float32(-4.0), t_9, Float32(Float32(0.1875) * t_10)), Float32(Float32(-0.0625) * fma(Float32(-6.0), t_17, Float32(Float32(0.078125) * t_5))))))))), fma(sqrt(ux), Float32(t_1 * sqrt(Float32(2.0))), Float32((ux ^ Float32(2.0)) * Float32(Float32(Float32(-0.5) * t_6) + Float32((ux ^ Float32(2.0)) * fma(Float32(-0.125), t_9, Float32(Float32(-0.0625) * t_17)))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{{ux}^{3}}\\
t_1 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
t_2 := \sqrt{{ux}^{3}}\\
t_3 := {\left(\sqrt{0.5}\right)}^{2}\\
t_4 := \sqrt{\frac{1}{ux}}\\
t_5 := t\_4 \cdot \frac{t\_1}{\sqrt{0.03125}}\\
t_6 := t\_4 \cdot \left(t\_1 \cdot \sqrt{0.5}\right)\\
t_7 := t\_4 \cdot \frac{t\_1}{\sqrt{0.5}}\\
t_8 := \sqrt{t\_0}\\
t_9 := t\_8 \cdot \left(t\_1 \cdot \sqrt{0.125}\right)\\
t_10 := t\_8 \cdot \frac{t\_1}{\sqrt{0.125}}\\
t_11 := 0.5 \cdot \frac{1}{ux}\\
t_12 := t\_11 - 0.0625 \cdot \frac{1}{ux \cdot t\_3}\\
t_13 := \sqrt{ux} \cdot \frac{t\_1 \cdot t\_12}{\sqrt{0.5}}\\
t_14 := {\left(\sqrt{0.125}\right)}^{2}\\
t_15 := 0.75 \cdot t\_0 - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot t\_14}\\
t_16 := t\_2 \cdot \frac{t\_1 \cdot t\_15}{\sqrt{0.125}}\\
t_17 := t\_4 \cdot \left(t\_1 \cdot \sqrt{0.03125}\right)\\
t_18 := {\left(\sqrt{0.03125}\right)}^{2}\\
t_19 := 0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot t\_18}\\
t_20 := \sqrt{ux} \cdot \frac{t\_1 \cdot t\_19}{\sqrt{0.03125}}\\
\mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{t\_1}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_1}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_1}{{\left(\sqrt{2}\right)}^{5}}, {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-1, t\_13, \mathsf{fma}\left(0.25, t\_7, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{t\_1 \cdot \left(t\_11 + \left(-1 \cdot 0.25\right) \cdot \frac{t\_12}{t\_3}\right)}{\sqrt{0.5}}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_9, \mathsf{fma}\left(-2, t\_16, \mathsf{fma}\left(0.5, t\_2 \cdot \frac{t\_1 \cdot \left(1.25 \cdot t\_0 - 0.1875 \cdot \frac{t\_15}{t\_14}\right)}{\sqrt{0.125}}, 1.125 \cdot t\_10\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, t\_17, \mathsf{fma}\left(-3, t\_20, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{t\_1 \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \frac{t\_19}{t\_18}\right)}{\sqrt{0.03125}}, 1.171875 \cdot t\_5\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-0.5, t\_7, \mathsf{fma}\left(0.5, t\_13, t\_6\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, t\_10, \mathsf{fma}\left(0.5, t\_16, 6 \cdot t\_9\right)\right), -0.0625 \cdot \left(-0.46875 \cdot t\_5 + \mathsf{fma}\left(0.5, t\_20, 15 \cdot t\_17\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, t\_6, 0.25 \cdot t\_7\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_9, 0.1875 \cdot t\_10\right), -0.0625 \cdot \mathsf{fma}\left(-6, t\_17, 0.078125 \cdot t\_5\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, t\_1 \cdot \sqrt{2}, {ux}^{2} \cdot \left(-0.5 \cdot t\_6 + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, t\_9, -0.0625 \cdot t\_17\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\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. *-commutativeN/A

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    6. lower-/.f32N/A

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\frac{1}{ux} \cdot 2 - \left(2 \cdot \frac{maxCos}{ux} + {\left(maxCos - 1\right)}^{2}\right)\right) \cdot {ux}^{2}} \]
    7. *-commutativeN/A

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  7. Applied rewrites96.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right), -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)\right)} \]
  8. Taylor expanded in maxCos around 0

    \[\leadsto maxCos \cdot \left(-1 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{2}}\right) + \left(maxCos \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{{\left(\sqrt{2}\right)}^{3}}\right) + \left(maxCos \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{{\left(\sqrt{2}\right)}^{5}}\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(-1 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right) + \left(\frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right) + \frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{4} \cdot \frac{\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(-4 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \left(-2 \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{5}{4} \cdot \frac{1}{{ux}^{3}} - \frac{3}{16} \cdot \frac{\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + \frac{9}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right)\right)\right)\right) + \frac{-1}{16} \cdot \left(-20 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right) + \left(-3 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{35}{32} \cdot \frac{1}{ux} - \frac{5}{64} \cdot \frac{\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + \frac{75}{64} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right)\right)\right)\right)\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right) + \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\frac{-3}{4} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + 6 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right)\right)\right) + \frac{-1}{16} \cdot \left(\frac{-15}{32} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + 15 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right)\right)\right)\right)\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(-2 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right) + \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(-4 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \frac{3}{16} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right)\right) + \frac{-1}{16} \cdot \left(-6 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right) + \frac{5}{64} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right)\right)\right)\right)\right)\right) + \color{blue}{\left(\sqrt{ux} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2}\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right)\right)\right)\right)} \]
  9. Applied rewrites95.2%

    \[\leadsto \mathsf{fma}\left(maxCos, \color{blue}{\mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{5}}, {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.25, \sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.25 \cdot \frac{0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}}{{\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), \mathsf{fma}\left(-2, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.25 \cdot \frac{1}{{ux}^{3}} - 0.1875 \cdot \frac{0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}}{{\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, 1.125 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), \mathsf{fma}\left(-3, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.09375 \cdot \frac{1}{ux} - 0.078125 \cdot \frac{0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}}{{\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, 1.171875 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-0.5, \sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, \sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, 6 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right)\right)\right)\right), -0.0625 \cdot \left(-0.46875 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right) + \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, 15 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right), 0.25 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}\right)\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), 0.1875 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right), -0.0625 \cdot \mathsf{fma}\left(-6, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), 0.078125 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)}, \mathsf{fma}\left(\sqrt{ux}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2}, {ux}^{2} \cdot \left(-0.5 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), -0.0625 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right) \]
  10. Final simplification95.2%

    \[\leadsto \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{5}}, {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.25, \sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} + \left(-1 \cdot 0.25\right) \cdot \frac{0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}}{{\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), \mathsf{fma}\left(-2, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.25 \cdot \frac{1}{{ux}^{3}} - 0.1875 \cdot \frac{0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}}{{\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, 1.125 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), \mathsf{fma}\left(-3, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \frac{0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}}{{\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, 1.171875 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.5, \mathsf{fma}\left(-0.5, \sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.5}\right)}^{2}}\right)}{\sqrt{0.5}}, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right)\right), {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, \sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, \sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{0.125}\right)}^{2}}\right)}{\sqrt{0.125}}, 6 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right)\right)\right)\right), -0.0625 \cdot \left(-0.46875 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right) + \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot {\left(\sqrt{0.03125}\right)}^{2}}\right)}{\sqrt{0.03125}}, 15 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right)\right)\right), {ux}^{2} \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right), 0.25 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}\right)\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), 0.1875 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right), -0.0625 \cdot \mathsf{fma}\left(-6, \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), 0.078125 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2}, {ux}^{2} \cdot \left(-0.5 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right) + {ux}^{2} \cdot \mathsf{fma}\left(-0.125, \sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), -0.0625 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right) \]
  11. Add Preprocessing

Alternative 7: 93.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{{ux}^{3}}\\ t_1 := {t\_0}^{0.5}\\ t_2 := 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\\ t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ t_4 := 0.0625 \cdot \frac{1}{ux \cdot 0.5}\\ t_5 := {\left({ux}^{3}\right)}^{0.5}\\ t_6 := 0.75 \cdot t\_0\\ t_7 := \frac{1}{\sqrt{ux}}\\ t_8 := t\_7 \cdot \frac{t\_3}{\sqrt{0.03125}}\\ t_9 := t\_7 \cdot \frac{t\_3}{\sqrt{0.5}}\\ t_10 := t\_7 \cdot \left(t\_3 \cdot \sqrt{0.5}\right)\\ t_11 := t\_1 \cdot \left(t\_3 \cdot \sqrt{0.125}\right)\\ t_12 := 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\\ t_13 := 0.5 \cdot \frac{1}{ux}\\ t_14 := \sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_13 - t\_4\right)}{\sqrt{0.5}}\\ t_15 := t\_1 \cdot \frac{t\_3}{\sqrt{0.125}}\\ t_16 := 0.46875 \cdot \frac{1}{ux}\\ t_17 := \sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_16 - t\_2\right)}{\sqrt{0.03125}}\\ t_18 := t\_5 \cdot \frac{t\_3 \cdot \left(t\_6 - t\_12\right)}{\sqrt{0.125}}\\ t_19 := t\_7 \cdot \left(t\_3 \cdot \sqrt{0.03125}\right)\\ \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{t\_3}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_3}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_3}{{\left(\sqrt{2}\right)}^{5}}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-1, t\_14, \mathsf{fma}\left(0.25, t\_9, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_13 + \left(-1 \cdot 0.25\right) \cdot \left(\frac{t\_13}{0.5} - \frac{t\_4}{0.5}\right)\right)}{\sqrt{0.5}}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_11, \mathsf{fma}\left(-2, t\_18, \mathsf{fma}\left(0.5, t\_5 \cdot \frac{t\_3 \cdot \left(1.25 \cdot t\_0 + \left(-1 \cdot 0.1875\right) \cdot \left(\frac{t\_6}{0.125} - \frac{t\_12}{0.125}\right)\right)}{\sqrt{0.125}}, 1.125 \cdot t\_15\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, t\_19, \mathsf{fma}\left(-3, t\_17, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{t\_3 \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \left(\frac{t\_16}{0.03125} - \frac{t\_2}{0.03125}\right)\right)}{\sqrt{0.03125}}, 1.171875 \cdot t\_8\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-0.5, t\_9, \mathsf{fma}\left(0.5, t\_14, t\_10\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, t\_15, \mathsf{fma}\left(0.5, t\_18, 6 \cdot t\_11\right)\right), -0.0625 \cdot \mathsf{fma}\left(-0.46875, t\_8, \mathsf{fma}\left(0.5, t\_17, 15 \cdot t\_19\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, t\_10, 0.25 \cdot t\_9\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_11, 0.1875 \cdot t\_15\right), -0.0625 \cdot \mathsf{fma}\left(-6, t\_19, 0.078125 \cdot t\_8\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, t\_3 \cdot \sqrt{2}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot t\_10 + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, t\_11, -0.0625 \cdot t\_19\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (/ 1.0 (pow ux 3.0)))
        (t_1 (pow t_0 0.5))
        (t_2 (* 0.006103515625 (/ 1.0 (* ux 0.03125))))
        (t_3 (sin (* 2.0 (* uy PI))))
        (t_4 (* 0.0625 (/ 1.0 (* ux 0.5))))
        (t_5 (pow (pow ux 3.0) 0.5))
        (t_6 (* 0.75 t_0))
        (t_7 (/ 1.0 (sqrt ux)))
        (t_8 (* t_7 (/ t_3 (sqrt 0.03125))))
        (t_9 (* t_7 (/ t_3 (sqrt 0.5))))
        (t_10 (* t_7 (* t_3 (sqrt 0.5))))
        (t_11 (* t_1 (* t_3 (sqrt 0.125))))
        (t_12 (* 0.03515625 (/ 1.0 (* (pow ux 3.0) 0.125))))
        (t_13 (* 0.5 (/ 1.0 ux)))
        (t_14 (* (sqrt ux) (/ (* t_3 (- t_13 t_4)) (sqrt 0.5))))
        (t_15 (* t_1 (/ t_3 (sqrt 0.125))))
        (t_16 (* 0.46875 (/ 1.0 ux)))
        (t_17 (* (sqrt ux) (/ (* t_3 (- t_16 t_2)) (sqrt 0.03125))))
        (t_18 (* t_5 (/ (* t_3 (- t_6 t_12)) (sqrt 0.125))))
        (t_19 (* t_7 (* t_3 (sqrt 0.03125)))))
   (fma
    maxCos
    (fma
     -1.0
     (* (sqrt ux) (/ t_3 (sqrt 2.0)))
     (fma
      maxCos
      (fma
       -0.5
       (* (sqrt ux) (/ t_3 (pow (sqrt 2.0) 3.0)))
       (fma
        maxCos
        (fma
         -0.5
         (* (sqrt ux) (/ t_3 (pow (sqrt 2.0) 5.0)))
         (*
          (* ux ux)
          (+
           (*
            -0.5
            (fma
             -1.0
             t_14
             (fma
              0.25
              t_9
              (*
               0.5
               (*
                (sqrt ux)
                (/
                 (*
                  t_3
                  (+ t_13 (* (* -1.0 0.25) (- (/ t_13 0.5) (/ t_4 0.5)))))
                 (sqrt 0.5)))))))
           (*
            (* ux ux)
            (fma
             -0.125
             (fma
              -4.0
              t_11
              (fma
               -2.0
               t_18
               (fma
                0.5
                (*
                 t_5
                 (/
                  (*
                   t_3
                   (+
                    (* 1.25 t_0)
                    (* (* -1.0 0.1875) (- (/ t_6 0.125) (/ t_12 0.125)))))
                  (sqrt 0.125)))
                (* 1.125 t_15))))
             (*
              -0.0625
              (fma
               -20.0
               t_19
               (fma
                -3.0
                t_17
                (fma
                 0.5
                 (*
                  (sqrt ux)
                  (/
                   (*
                    t_3
                    (+
                     (* 1.09375 (/ 1.0 ux))
                     (*
                      (* -1.0 0.078125)
                      (- (/ t_16 0.03125) (/ t_2 0.03125)))))
                   (sqrt 0.03125)))
                 (* 1.171875 t_8))))))))))
        (*
         (* ux ux)
         (+
          (* -0.5 (fma -0.5 t_9 (fma 0.5 t_14 t_10)))
          (*
           (* ux ux)
           (fma
            -0.125
            (fma -0.75 t_15 (fma 0.5 t_18 (* 6.0 t_11)))
            (* -0.0625 (fma -0.46875 t_8 (fma 0.5 t_17 (* 15.0 t_19))))))))))
      (*
       (* ux ux)
       (+
        (* -0.5 (fma -2.0 t_10 (* 0.25 t_9)))
        (*
         (* ux ux)
         (fma
          -0.125
          (fma -4.0 t_11 (* 0.1875 t_15))
          (* -0.0625 (fma -6.0 t_19 (* 0.078125 t_8)))))))))
    (fma
     (sqrt ux)
     (* t_3 (sqrt 2.0))
     (*
      (* ux ux)
      (+ (* -0.5 t_10) (* (* ux ux) (fma -0.125 t_11 (* -0.0625 t_19)))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 1.0f / powf(ux, 3.0f);
	float t_1 = powf(t_0, 0.5f);
	float t_2 = 0.006103515625f * (1.0f / (ux * 0.03125f));
	float t_3 = sinf((2.0f * (uy * ((float) M_PI))));
	float t_4 = 0.0625f * (1.0f / (ux * 0.5f));
	float t_5 = powf(powf(ux, 3.0f), 0.5f);
	float t_6 = 0.75f * t_0;
	float t_7 = 1.0f / sqrtf(ux);
	float t_8 = t_7 * (t_3 / sqrtf(0.03125f));
	float t_9 = t_7 * (t_3 / sqrtf(0.5f));
	float t_10 = t_7 * (t_3 * sqrtf(0.5f));
	float t_11 = t_1 * (t_3 * sqrtf(0.125f));
	float t_12 = 0.03515625f * (1.0f / (powf(ux, 3.0f) * 0.125f));
	float t_13 = 0.5f * (1.0f / ux);
	float t_14 = sqrtf(ux) * ((t_3 * (t_13 - t_4)) / sqrtf(0.5f));
	float t_15 = t_1 * (t_3 / sqrtf(0.125f));
	float t_16 = 0.46875f * (1.0f / ux);
	float t_17 = sqrtf(ux) * ((t_3 * (t_16 - t_2)) / sqrtf(0.03125f));
	float t_18 = t_5 * ((t_3 * (t_6 - t_12)) / sqrtf(0.125f));
	float t_19 = t_7 * (t_3 * sqrtf(0.03125f));
	return fmaf(maxCos, fmaf(-1.0f, (sqrtf(ux) * (t_3 / sqrtf(2.0f))), fmaf(maxCos, fmaf(-0.5f, (sqrtf(ux) * (t_3 / powf(sqrtf(2.0f), 3.0f))), fmaf(maxCos, fmaf(-0.5f, (sqrtf(ux) * (t_3 / powf(sqrtf(2.0f), 5.0f))), ((ux * ux) * ((-0.5f * fmaf(-1.0f, t_14, fmaf(0.25f, t_9, (0.5f * (sqrtf(ux) * ((t_3 * (t_13 + ((-1.0f * 0.25f) * ((t_13 / 0.5f) - (t_4 / 0.5f))))) / sqrtf(0.5f))))))) + ((ux * ux) * fmaf(-0.125f, fmaf(-4.0f, t_11, fmaf(-2.0f, t_18, fmaf(0.5f, (t_5 * ((t_3 * ((1.25f * t_0) + ((-1.0f * 0.1875f) * ((t_6 / 0.125f) - (t_12 / 0.125f))))) / sqrtf(0.125f))), (1.125f * t_15)))), (-0.0625f * fmaf(-20.0f, t_19, fmaf(-3.0f, t_17, fmaf(0.5f, (sqrtf(ux) * ((t_3 * ((1.09375f * (1.0f / ux)) + ((-1.0f * 0.078125f) * ((t_16 / 0.03125f) - (t_2 / 0.03125f))))) / sqrtf(0.03125f))), (1.171875f * t_8)))))))))), ((ux * ux) * ((-0.5f * fmaf(-0.5f, t_9, fmaf(0.5f, t_14, t_10))) + ((ux * ux) * fmaf(-0.125f, fmaf(-0.75f, t_15, fmaf(0.5f, t_18, (6.0f * t_11))), (-0.0625f * fmaf(-0.46875f, t_8, fmaf(0.5f, t_17, (15.0f * t_19)))))))))), ((ux * ux) * ((-0.5f * fmaf(-2.0f, t_10, (0.25f * t_9))) + ((ux * ux) * fmaf(-0.125f, fmaf(-4.0f, t_11, (0.1875f * t_15)), (-0.0625f * fmaf(-6.0f, t_19, (0.078125f * t_8))))))))), fmaf(sqrtf(ux), (t_3 * sqrtf(2.0f)), ((ux * ux) * ((-0.5f * t_10) + ((ux * ux) * fmaf(-0.125f, t_11, (-0.0625f * t_19)))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(1.0) / (ux ^ Float32(3.0)))
	t_1 = t_0 ^ Float32(0.5)
	t_2 = Float32(Float32(0.006103515625) * Float32(Float32(1.0) / Float32(ux * Float32(0.03125))))
	t_3 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	t_4 = Float32(Float32(0.0625) * Float32(Float32(1.0) / Float32(ux * Float32(0.5))))
	t_5 = (ux ^ Float32(3.0)) ^ Float32(0.5)
	t_6 = Float32(Float32(0.75) * t_0)
	t_7 = Float32(Float32(1.0) / sqrt(ux))
	t_8 = Float32(t_7 * Float32(t_3 / sqrt(Float32(0.03125))))
	t_9 = Float32(t_7 * Float32(t_3 / sqrt(Float32(0.5))))
	t_10 = Float32(t_7 * Float32(t_3 * sqrt(Float32(0.5))))
	t_11 = Float32(t_1 * Float32(t_3 * sqrt(Float32(0.125))))
	t_12 = Float32(Float32(0.03515625) * Float32(Float32(1.0) / Float32((ux ^ Float32(3.0)) * Float32(0.125))))
	t_13 = Float32(Float32(0.5) * Float32(Float32(1.0) / ux))
	t_14 = Float32(sqrt(ux) * Float32(Float32(t_3 * Float32(t_13 - t_4)) / sqrt(Float32(0.5))))
	t_15 = Float32(t_1 * Float32(t_3 / sqrt(Float32(0.125))))
	t_16 = Float32(Float32(0.46875) * Float32(Float32(1.0) / ux))
	t_17 = Float32(sqrt(ux) * Float32(Float32(t_3 * Float32(t_16 - t_2)) / sqrt(Float32(0.03125))))
	t_18 = Float32(t_5 * Float32(Float32(t_3 * Float32(t_6 - t_12)) / sqrt(Float32(0.125))))
	t_19 = Float32(t_7 * Float32(t_3 * sqrt(Float32(0.03125))))
	return fma(maxCos, fma(Float32(-1.0), Float32(sqrt(ux) * Float32(t_3 / sqrt(Float32(2.0)))), fma(maxCos, fma(Float32(-0.5), Float32(sqrt(ux) * Float32(t_3 / (sqrt(Float32(2.0)) ^ Float32(3.0)))), fma(maxCos, fma(Float32(-0.5), Float32(sqrt(ux) * Float32(t_3 / (sqrt(Float32(2.0)) ^ Float32(5.0)))), Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * fma(Float32(-1.0), t_14, fma(Float32(0.25), t_9, Float32(Float32(0.5) * Float32(sqrt(ux) * Float32(Float32(t_3 * Float32(t_13 + Float32(Float32(Float32(-1.0) * Float32(0.25)) * Float32(Float32(t_13 / Float32(0.5)) - Float32(t_4 / Float32(0.5)))))) / sqrt(Float32(0.5)))))))) + Float32(Float32(ux * ux) * fma(Float32(-0.125), fma(Float32(-4.0), t_11, fma(Float32(-2.0), t_18, fma(Float32(0.5), Float32(t_5 * Float32(Float32(t_3 * Float32(Float32(Float32(1.25) * t_0) + Float32(Float32(Float32(-1.0) * Float32(0.1875)) * Float32(Float32(t_6 / Float32(0.125)) - Float32(t_12 / Float32(0.125)))))) / sqrt(Float32(0.125)))), Float32(Float32(1.125) * t_15)))), Float32(Float32(-0.0625) * fma(Float32(-20.0), t_19, fma(Float32(-3.0), t_17, fma(Float32(0.5), Float32(sqrt(ux) * Float32(Float32(t_3 * Float32(Float32(Float32(1.09375) * Float32(Float32(1.0) / ux)) + Float32(Float32(Float32(-1.0) * Float32(0.078125)) * Float32(Float32(t_16 / Float32(0.03125)) - Float32(t_2 / Float32(0.03125)))))) / sqrt(Float32(0.03125)))), Float32(Float32(1.171875) * t_8)))))))))), Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * fma(Float32(-0.5), t_9, fma(Float32(0.5), t_14, t_10))) + Float32(Float32(ux * ux) * fma(Float32(-0.125), fma(Float32(-0.75), t_15, fma(Float32(0.5), t_18, Float32(Float32(6.0) * t_11))), Float32(Float32(-0.0625) * fma(Float32(-0.46875), t_8, fma(Float32(0.5), t_17, Float32(Float32(15.0) * t_19)))))))))), Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * fma(Float32(-2.0), t_10, Float32(Float32(0.25) * t_9))) + Float32(Float32(ux * ux) * fma(Float32(-0.125), fma(Float32(-4.0), t_11, Float32(Float32(0.1875) * t_15)), Float32(Float32(-0.0625) * fma(Float32(-6.0), t_19, Float32(Float32(0.078125) * t_8))))))))), fma(sqrt(ux), Float32(t_3 * sqrt(Float32(2.0))), Float32(Float32(ux * ux) * Float32(Float32(Float32(-0.5) * t_10) + Float32(Float32(ux * ux) * fma(Float32(-0.125), t_11, Float32(Float32(-0.0625) * t_19)))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{{ux}^{3}}\\
t_1 := {t\_0}^{0.5}\\
t_2 := 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\\
t_3 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
t_4 := 0.0625 \cdot \frac{1}{ux \cdot 0.5}\\
t_5 := {\left({ux}^{3}\right)}^{0.5}\\
t_6 := 0.75 \cdot t\_0\\
t_7 := \frac{1}{\sqrt{ux}}\\
t_8 := t\_7 \cdot \frac{t\_3}{\sqrt{0.03125}}\\
t_9 := t\_7 \cdot \frac{t\_3}{\sqrt{0.5}}\\
t_10 := t\_7 \cdot \left(t\_3 \cdot \sqrt{0.5}\right)\\
t_11 := t\_1 \cdot \left(t\_3 \cdot \sqrt{0.125}\right)\\
t_12 := 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\\
t_13 := 0.5 \cdot \frac{1}{ux}\\
t_14 := \sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_13 - t\_4\right)}{\sqrt{0.5}}\\
t_15 := t\_1 \cdot \frac{t\_3}{\sqrt{0.125}}\\
t_16 := 0.46875 \cdot \frac{1}{ux}\\
t_17 := \sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_16 - t\_2\right)}{\sqrt{0.03125}}\\
t_18 := t\_5 \cdot \frac{t\_3 \cdot \left(t\_6 - t\_12\right)}{\sqrt{0.125}}\\
t_19 := t\_7 \cdot \left(t\_3 \cdot \sqrt{0.03125}\right)\\
\mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{t\_3}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_3}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{t\_3}{{\left(\sqrt{2}\right)}^{5}}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-1, t\_14, \mathsf{fma}\left(0.25, t\_9, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{t\_3 \cdot \left(t\_13 + \left(-1 \cdot 0.25\right) \cdot \left(\frac{t\_13}{0.5} - \frac{t\_4}{0.5}\right)\right)}{\sqrt{0.5}}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_11, \mathsf{fma}\left(-2, t\_18, \mathsf{fma}\left(0.5, t\_5 \cdot \frac{t\_3 \cdot \left(1.25 \cdot t\_0 + \left(-1 \cdot 0.1875\right) \cdot \left(\frac{t\_6}{0.125} - \frac{t\_12}{0.125}\right)\right)}{\sqrt{0.125}}, 1.125 \cdot t\_15\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, t\_19, \mathsf{fma}\left(-3, t\_17, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{t\_3 \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \left(\frac{t\_16}{0.03125} - \frac{t\_2}{0.03125}\right)\right)}{\sqrt{0.03125}}, 1.171875 \cdot t\_8\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-0.5, t\_9, \mathsf{fma}\left(0.5, t\_14, t\_10\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, t\_15, \mathsf{fma}\left(0.5, t\_18, 6 \cdot t\_11\right)\right), -0.0625 \cdot \mathsf{fma}\left(-0.46875, t\_8, \mathsf{fma}\left(0.5, t\_17, 15 \cdot t\_19\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, t\_10, 0.25 \cdot t\_9\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, t\_11, 0.1875 \cdot t\_15\right), -0.0625 \cdot \mathsf{fma}\left(-6, t\_19, 0.078125 \cdot t\_8\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, t\_3 \cdot \sqrt{2}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot t\_10 + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, t\_11, -0.0625 \cdot t\_19\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  4. Applied rewrites96.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
  5. Taylor expanded in maxCos around 0

    \[\leadsto maxCos \cdot \left(-1 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{2}}\right) + \left(maxCos \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{{\left(\sqrt{2}\right)}^{3}}\right) + \left(maxCos \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{{\left(\sqrt{2}\right)}^{5}}\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(-1 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right) + \left(\frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right) + \frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{4} \cdot \frac{\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(-4 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \left(-2 \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{5}{4} \cdot \frac{1}{{ux}^{3}} - \frac{3}{16} \cdot \frac{\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + \frac{9}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right)\right)\right)\right) + \frac{-1}{16} \cdot \left(-20 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right) + \left(-3 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{35}{32} \cdot \frac{1}{ux} - \frac{5}{64} \cdot \frac{\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}}{{\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + \frac{75}{64} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right)\right)\right)\right)\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{ux} - \frac{1}{16} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}{\sqrt{\frac{1}{2}}}\right) + \sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\frac{-3}{4} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{{ux}^{3}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{3}{4} \cdot \frac{1}{{ux}^{3}} - \frac{9}{256} \cdot \frac{1}{{ux}^{3} \cdot {\left(\sqrt{\frac{1}{8}}\right)}^{2}}\right)}{\sqrt{\frac{1}{8}}}\right) + 6 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right)\right)\right) + \frac{-1}{16} \cdot \left(\frac{-15}{32} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right) + \left(\frac{1}{2} \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{15}{32} \cdot \frac{1}{ux} - \frac{25}{4096} \cdot \frac{1}{ux \cdot {\left(\sqrt{\frac{1}{32}}\right)}^{2}}\right)}{\sqrt{\frac{1}{32}}}\right) + 15 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right)\right)\right)\right)\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(-2 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right) + \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{2}}}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(-4 \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \frac{3}{16} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{8}}}\right)\right) + \frac{-1}{16} \cdot \left(-6 \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right) + \frac{5}{64} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{\sqrt{\frac{1}{32}}}\right)\right)\right)\right)\right)\right) + \color{blue}{\left(\sqrt{ux} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2}\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{2}}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{8}}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\frac{1}{32}}\right)\right)\right)\right)\right)} \]
  6. Applied rewrites95.2%

    \[\leadsto \mathsf{fma}\left(maxCos, \color{blue}{\mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{5}}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot 0.5}\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.25, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.25 \cdot \left(\frac{0.5 \cdot \frac{1}{ux}}{0.5} - \frac{0.0625 \cdot \frac{1}{ux \cdot 0.5}}{0.5}\right)\right)}{\sqrt{0.5}}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), \mathsf{fma}\left(-2, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.25 \cdot \frac{1}{{ux}^{3}} - 0.1875 \cdot \left(\frac{0.75 \cdot \frac{1}{{ux}^{3}}}{0.125} - \frac{0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}}{0.125}\right)\right)}{\sqrt{0.125}}, 1.125 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), \mathsf{fma}\left(-3, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.09375 \cdot \frac{1}{ux} - 0.078125 \cdot \left(\frac{0.46875 \cdot \frac{1}{ux}}{0.03125} - \frac{0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}}{0.03125}\right)\right)}{\sqrt{0.03125}}, 1.171875 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-0.5, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot 0.5}\right)}{\sqrt{0.5}}, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\right)}{\sqrt{0.125}}, 6 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-0.46875, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\right)}{\sqrt{0.03125}}, 15 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right), 0.25 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), 0.1875 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right), -0.0625 \cdot \mathsf{fma}\left(-6, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), 0.078125 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)}, \mathsf{fma}\left(\sqrt{ux}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), -0.0625 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right) \]
  7. Final simplification95.2%

    \[\leadsto \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{2}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{3}}, \mathsf{fma}\left(maxCos, \mathsf{fma}\left(-0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{{\left(\sqrt{2}\right)}^{5}}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-1, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot 0.5}\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.25, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, 0.5 \cdot \left(\sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} + \left(-1 \cdot 0.25\right) \cdot \left(\frac{0.5 \cdot \frac{1}{ux}}{0.5} - \frac{0.0625 \cdot \frac{1}{ux \cdot 0.5}}{0.5}\right)\right)}{\sqrt{0.5}}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), \mathsf{fma}\left(-2, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.25 \cdot \frac{1}{{ux}^{3}} + \left(-1 \cdot 0.1875\right) \cdot \left(\frac{0.75 \cdot \frac{1}{{ux}^{3}}}{0.125} - \frac{0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}}{0.125}\right)\right)}{\sqrt{0.125}}, 1.125 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-20, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), \mathsf{fma}\left(-3, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(1.09375 \cdot \frac{1}{ux} + \left(-1 \cdot 0.078125\right) \cdot \left(\frac{0.46875 \cdot \frac{1}{ux}}{0.03125} - \frac{0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}}{0.03125}\right)\right)}{\sqrt{0.03125}}, 1.171875 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-0.5, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.5 \cdot \frac{1}{ux} - 0.0625 \cdot \frac{1}{ux \cdot 0.5}\right)}{\sqrt{0.5}}, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-0.75, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}, \mathsf{fma}\left(0.5, {\left({ux}^{3}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.75 \cdot \frac{1}{{ux}^{3}} - 0.03515625 \cdot \frac{1}{{ux}^{3} \cdot 0.125}\right)}{\sqrt{0.125}}, 6 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right)\right)\right)\right), -0.0625 \cdot \mathsf{fma}\left(-0.46875, \frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}, \mathsf{fma}\left(0.5, \sqrt{ux} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(0.46875 \cdot \frac{1}{ux} - 0.006103515625 \cdot \frac{1}{ux \cdot 0.03125}\right)}{\sqrt{0.03125}}, 15 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right)\right)\right), \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \mathsf{fma}\left(-2, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right), 0.25 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.5}}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, \mathsf{fma}\left(-4, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), 0.1875 \cdot \left({\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.125}}\right)\right), -0.0625 \cdot \mathsf{fma}\left(-6, \frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right), 0.078125 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \frac{\sin \left(2 \cdot \left(uy \cdot \pi\right)\right)}{\sqrt{0.03125}}\right)\right)\right)\right)\right)\right), \mathsf{fma}\left(\sqrt{ux}, \sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{2}, \left(ux \cdot ux\right) \cdot \left(-0.5 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.5}\right)\right) + \left(ux \cdot ux\right) \cdot \mathsf{fma}\left(-0.125, {\left(\frac{1}{{ux}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.125}\right), -0.0625 \cdot \left(\frac{1}{\sqrt{ux}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{0.03125}\right)\right)\right)\right)\right)\right) \]
  8. Add Preprocessing

Alternative 8: 86.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\ t_1 := 2 - 2 \cdot maxCos\\ t_2 := \frac{1}{ux \cdot {t\_1}^{5}}\\ t_3 := {\left(maxCos - 1\right)}^{6}\\ t_4 := \frac{1}{ux \cdot {t\_1}^{3}}\\ t_5 := \sqrt{\frac{t\_1}{{ux}^{3}}}\\ t_6 := {\left(maxCos - 1\right)}^{2}\\ t_7 := \frac{1}{{\left(ux \cdot t\_1\right)}^{0.5}}\\ t_8 := {\left(maxCos - 1\right)}^{4}\\ \mathbf{if}\;uy \leq 0.0020000000949949026:\\ \;\;\;\;{ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, t\_5 \cdot \pi, \left(t\_7 \cdot -1\right) \cdot \left(\pi \cdot t\_6\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{t\_4} \cdot \left(\pi \cdot t\_8\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{t\_2} \cdot \left(\pi \cdot t\_3\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, t\_5 \cdot \left(t\_0 \cdot -1\right), -0.5 \cdot \left(t\_7 \cdot \left(t\_0 \cdot \left(-1 \cdot t\_6\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({t\_4}^{0.5} \cdot \left(t\_0 \cdot \left(-1 \cdot t\_8\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({t\_2}^{0.5} \cdot \left(t\_0 \cdot \left(-1 \cdot t\_3\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (sin (* 2.0 (* uy PI))))
        (t_1 (- 2.0 (* 2.0 maxCos)))
        (t_2 (/ 1.0 (* ux (pow t_1 5.0))))
        (t_3 (pow (- maxCos 1.0) 6.0))
        (t_4 (/ 1.0 (* ux (pow t_1 3.0))))
        (t_5 (sqrt (/ t_1 (pow ux 3.0))))
        (t_6 (pow (- maxCos 1.0) 2.0))
        (t_7 (/ 1.0 (pow (* ux t_1) 0.5)))
        (t_8 (pow (- maxCos 1.0) 4.0)))
   (if (<= uy 0.0020000000949949026)
     (*
      (pow ux 4.0)
      (*
       uy
       (fma
        -1.0
        (/
         (fma
          -1.0
          (/ (fma 2.0 (* t_5 PI) (* (* t_7 -1.0) (* PI t_6))) ux)
          (* 0.25 (* (sqrt t_4) (* PI t_8))))
         ux)
        (* 0.125 (* (sqrt t_2) (* PI t_3))))))
     (*
      (pow ux 4.0)
      (fma
       -1.0
       (/
        (fma
         -1.0
         (/
          (fma -1.0 (* t_5 (* t_0 -1.0)) (* -0.5 (* t_7 (* t_0 (* -1.0 t_6)))))
          ux)
         (* -0.125 (* (pow t_4 0.5) (* t_0 (* -1.0 t_8)))))
        ux)
       (* -0.0625 (* (pow t_2 0.5) (* t_0 (* -1.0 t_3)))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = sinf((2.0f * (uy * ((float) M_PI))));
	float t_1 = 2.0f - (2.0f * maxCos);
	float t_2 = 1.0f / (ux * powf(t_1, 5.0f));
	float t_3 = powf((maxCos - 1.0f), 6.0f);
	float t_4 = 1.0f / (ux * powf(t_1, 3.0f));
	float t_5 = sqrtf((t_1 / powf(ux, 3.0f)));
	float t_6 = powf((maxCos - 1.0f), 2.0f);
	float t_7 = 1.0f / powf((ux * t_1), 0.5f);
	float t_8 = powf((maxCos - 1.0f), 4.0f);
	float tmp;
	if (uy <= 0.0020000000949949026f) {
		tmp = powf(ux, 4.0f) * (uy * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(2.0f, (t_5 * ((float) M_PI)), ((t_7 * -1.0f) * (((float) M_PI) * t_6))) / ux), (0.25f * (sqrtf(t_4) * (((float) M_PI) * t_8)))) / ux), (0.125f * (sqrtf(t_2) * (((float) M_PI) * t_3)))));
	} else {
		tmp = powf(ux, 4.0f) * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(-1.0f, (t_5 * (t_0 * -1.0f)), (-0.5f * (t_7 * (t_0 * (-1.0f * t_6))))) / ux), (-0.125f * (powf(t_4, 0.5f) * (t_0 * (-1.0f * t_8))))) / ux), (-0.0625f * (powf(t_2, 0.5f) * (t_0 * (-1.0f * t_3)))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	t_0 = sin(Float32(Float32(2.0) * Float32(uy * Float32(pi))))
	t_1 = Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos))
	t_2 = Float32(Float32(1.0) / Float32(ux * (t_1 ^ Float32(5.0))))
	t_3 = Float32(maxCos - Float32(1.0)) ^ Float32(6.0)
	t_4 = Float32(Float32(1.0) / Float32(ux * (t_1 ^ Float32(3.0))))
	t_5 = sqrt(Float32(t_1 / (ux ^ Float32(3.0))))
	t_6 = Float32(maxCos - Float32(1.0)) ^ Float32(2.0)
	t_7 = Float32(Float32(1.0) / (Float32(ux * t_1) ^ Float32(0.5)))
	t_8 = Float32(maxCos - Float32(1.0)) ^ Float32(4.0)
	tmp = Float32(0.0)
	if (uy <= Float32(0.0020000000949949026))
		tmp = Float32((ux ^ Float32(4.0)) * Float32(uy * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(2.0), Float32(t_5 * Float32(pi)), Float32(Float32(t_7 * Float32(-1.0)) * Float32(Float32(pi) * t_6))) / ux), Float32(Float32(0.25) * Float32(sqrt(t_4) * Float32(Float32(pi) * t_8)))) / ux), Float32(Float32(0.125) * Float32(sqrt(t_2) * Float32(Float32(pi) * t_3))))));
	else
		tmp = Float32((ux ^ Float32(4.0)) * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(t_5 * Float32(t_0 * Float32(-1.0))), Float32(Float32(-0.5) * Float32(t_7 * Float32(t_0 * Float32(Float32(-1.0) * t_6))))) / ux), Float32(Float32(-0.125) * Float32((t_4 ^ Float32(0.5)) * Float32(t_0 * Float32(Float32(-1.0) * t_8))))) / ux), Float32(Float32(-0.0625) * Float32((t_2 ^ Float32(0.5)) * Float32(t_0 * Float32(Float32(-1.0) * t_3))))));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(2 \cdot \left(uy \cdot \pi\right)\right)\\
t_1 := 2 - 2 \cdot maxCos\\
t_2 := \frac{1}{ux \cdot {t\_1}^{5}}\\
t_3 := {\left(maxCos - 1\right)}^{6}\\
t_4 := \frac{1}{ux \cdot {t\_1}^{3}}\\
t_5 := \sqrt{\frac{t\_1}{{ux}^{3}}}\\
t_6 := {\left(maxCos - 1\right)}^{2}\\
t_7 := \frac{1}{{\left(ux \cdot t\_1\right)}^{0.5}}\\
t_8 := {\left(maxCos - 1\right)}^{4}\\
\mathbf{if}\;uy \leq 0.0020000000949949026:\\
\;\;\;\;{ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, t\_5 \cdot \pi, \left(t\_7 \cdot -1\right) \cdot \left(\pi \cdot t\_6\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{t\_4} \cdot \left(\pi \cdot t\_8\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{t\_2} \cdot \left(\pi \cdot t\_3\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{ux}^{4} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, t\_5 \cdot \left(t\_0 \cdot -1\right), -0.5 \cdot \left(t\_7 \cdot \left(t\_0 \cdot \left(-1 \cdot t\_6\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({t\_4}^{0.5} \cdot \left(t\_0 \cdot \left(-1 \cdot t\_8\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({t\_2}^{0.5} \cdot \left(t\_0 \cdot \left(-1 \cdot t\_3\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.00200000009

    1. Initial program 57.2%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
    5. Taylor expanded in ux around -inf

      \[\leadsto {ux}^{4} \cdot \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \left(\sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot {\left(maxCos - 1\right)}^{2}\right)\right)\right)}{ux} + \frac{-1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux} + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
    6. Applied rewrites76.7%

      \[\leadsto {ux}^{4} \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot -1\right), -0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
    7. Taylor expanded in uy around 0

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \left(-1 \cdot \frac{-1 \cdot \frac{2 \cdot \left(\sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \mathsf{PI}\left(\right)\right) + \sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(maxCos - 1\right)}^{2}\right)}{ux} + \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right)}{ux} + \color{blue}{\frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)}\right)\right) \]
    8. Applied rewrites75.9%

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    9. Taylor expanded in ux around -inf

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    10. Step-by-step derivation
      1. sqrt-divN/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      3. pow1/2N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      4. sqrt-pow2N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {-1}^{1}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      6. metadata-evalN/A

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

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      8. sqrt-divN/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{\sqrt{1}}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      10. pow1/2N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      11. lift-*.f32N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      12. lift--.f32N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      13. lift-*.f32N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      14. lift-pow.f32N/A

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
      15. lift-/.f3294.2

        \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    11. Applied rewrites94.2%

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]

    if 0.00200000009 < uy

    1. Initial program 57.5%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
    5. Taylor expanded in ux around -inf

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

      \[\leadsto {ux}^{4} \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot -1\right), -0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 78.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - 2 \cdot maxCos\\ {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{t\_0}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot t\_0\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {t\_0}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {t\_0}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (- 2.0 (* 2.0 maxCos))))
   (*
    (pow ux 4.0)
    (*
     uy
     (fma
      -1.0
      (/
       (fma
        -1.0
        (/
         (fma
          2.0
          (* (sqrt (/ t_0 (pow ux 3.0))) PI)
          (*
           (* (/ 1.0 (pow (* ux t_0) 0.5)) -1.0)
           (* PI (pow (- maxCos 1.0) 2.0))))
         ux)
        (*
         0.25
         (*
          (sqrt (/ 1.0 (* ux (pow t_0 3.0))))
          (* PI (pow (- maxCos 1.0) 4.0)))))
       ux)
      (*
       0.125
       (*
        (sqrt (/ 1.0 (* ux (pow t_0 5.0))))
        (* PI (pow (- maxCos 1.0) 6.0)))))))))
float code(float ux, float uy, float maxCos) {
	float t_0 = 2.0f - (2.0f * maxCos);
	return powf(ux, 4.0f) * (uy * fmaf(-1.0f, (fmaf(-1.0f, (fmaf(2.0f, (sqrtf((t_0 / powf(ux, 3.0f))) * ((float) M_PI)), (((1.0f / powf((ux * t_0), 0.5f)) * -1.0f) * (((float) M_PI) * powf((maxCos - 1.0f), 2.0f)))) / ux), (0.25f * (sqrtf((1.0f / (ux * powf(t_0, 3.0f)))) * (((float) M_PI) * powf((maxCos - 1.0f), 4.0f))))) / ux), (0.125f * (sqrtf((1.0f / (ux * powf(t_0, 5.0f)))) * (((float) M_PI) * powf((maxCos - 1.0f), 6.0f))))));
}
function code(ux, uy, maxCos)
	t_0 = Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos))
	return Float32((ux ^ Float32(4.0)) * Float32(uy * fma(Float32(-1.0), Float32(fma(Float32(-1.0), Float32(fma(Float32(2.0), Float32(sqrt(Float32(t_0 / (ux ^ Float32(3.0)))) * Float32(pi)), Float32(Float32(Float32(Float32(1.0) / (Float32(ux * t_0) ^ Float32(0.5))) * Float32(-1.0)) * Float32(Float32(pi) * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) / ux), Float32(Float32(0.25) * Float32(sqrt(Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(3.0))))) * Float32(Float32(pi) * (Float32(maxCos - Float32(1.0)) ^ Float32(4.0)))))) / ux), Float32(Float32(0.125) * Float32(sqrt(Float32(Float32(1.0) / Float32(ux * (t_0 ^ Float32(5.0))))) * Float32(Float32(pi) * (Float32(maxCos - Float32(1.0)) ^ Float32(6.0))))))))
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - 2 \cdot maxCos\\
{ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{t\_0}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot t\_0\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {t\_0}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {t\_0}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 57.3%

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

    \[\leadsto \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)} \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{2}\right)\right) + {ux}^{2} \cdot \left(\frac{-1}{8} \cdot \left(\sqrt{\frac{1}{{ux}^{3} \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{4}\right)\right) + \frac{-1}{16} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  4. Applied rewrites96.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \sqrt{\frac{\frac{1}{ux}}{2 - maxCos \cdot 2}}, {\left(maxCos - 1\right)}^{2} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right), \mathsf{fma}\left(\left({\left(maxCos - 1\right)}^{6} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right) \cdot \sqrt{\frac{\frac{1}{ux}}{{\left(2 - maxCos \cdot 2\right)}^{2.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{2.5}}}, -0.0625, \left(\sqrt{\frac{\frac{1}{{ux}^{3}}}{{\left(2 - maxCos \cdot 2\right)}^{1.5} \cdot {\left(2 - maxCos \cdot 2\right)}^{1.5}}} \cdot \left({\left(maxCos - 1\right)}^{4} \cdot \sin \left(\pi \cdot \left(2 \cdot uy\right)\right)\right)\right) \cdot -0.125\right) \cdot \left(ux \cdot ux\right)\right), ux \cdot ux, \sin \left(\pi \cdot \left(2 \cdot uy\right)\right) \cdot \left(\sqrt{ux} \cdot \sqrt{2 - maxCos \cdot 2}\right)\right)} \]
  5. Taylor expanded in ux around -inf

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

    \[\leadsto {ux}^{4} \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot -1\right), -0.5 \cdot \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{2}\right)\right)\right)\right)}{ux}, -0.125 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)\right)}{ux}, -0.0625 \cdot \left({\left(\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}\right)}^{0.5} \cdot \left(\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \left(-1 \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right)} \]
  7. Taylor expanded in uy around 0

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

    \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
  9. Taylor expanded in ux around -inf

    \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
  10. Step-by-step derivation
    1. sqrt-divN/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    2. metadata-evalN/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    3. pow1/2N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    4. sqrt-pow2N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot {-1}^{1}\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    6. metadata-evalN/A

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

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\sqrt{\frac{1}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    8. sqrt-divN/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{\sqrt{1}}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    10. pow1/2N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    11. lift-*.f32N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    12. lift--.f32N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    13. lift-*.f32N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    14. lift-pow.f32N/A

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, \frac{1}{4} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, \frac{1}{8} \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
    15. lift-/.f3280.3

      \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
  11. Applied rewrites80.3%

    \[\leadsto {ux}^{4} \cdot \left(uy \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(2, \sqrt{\frac{2 - 2 \cdot maxCos}{{ux}^{3}}} \cdot \pi, \left(\frac{1}{{\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{0.5}} \cdot -1\right) \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{2}\right)\right)}{ux}, 0.25 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{3}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{4}\right)\right)\right)}{ux}, 0.125 \cdot \left(\sqrt{\frac{1}{ux \cdot {\left(2 - 2 \cdot maxCos\right)}^{5}}} \cdot \left(\pi \cdot {\left(maxCos - 1\right)}^{6}\right)\right)\right)\right) \]
  12. Add Preprocessing

Reproduce

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