UniformSampleCone, y

Percentage Accurate: 57.3% → 98.3%
Time: 8.0s
Alternatives: 16
Speedup: 4.8×

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} 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} \]
(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}
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 57.3% accurate, 1.0× speedup?

\[\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} \]
(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}
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}

Alternative 1: 98.3% accurate, 1.0× speedup?

\[\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(\left(\frac{ux}{maxCos} - ux\right) \cdot maxCos\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
(FPCore (ux uy maxCos)
  :precision binary32
  (*
 (sqrt (* (- (fma maxCos ux 2.0) ux) (* (- (/ ux maxCos) ux) maxCos)))
 (sin (* PI (+ uy uy)))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((fmaf(maxCos, ux, 2.0f) - ux) * (((ux / maxCos) - ux) * maxCos))) * sinf((((float) M_PI) * (uy + uy)));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(fma(maxCos, ux, Float32(2.0)) - ux) * Float32(Float32(Float32(ux / maxCos) - ux) * maxCos))) * sin(Float32(Float32(pi) * Float32(uy + uy))))
end
\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(\left(\frac{ux}{maxCos} - ux\right) \cdot maxCos\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right)
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. Step-by-step derivation
    1. lift--.f32N/A

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 1.1× speedup?

\[\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
(FPCore (ux uy maxCos)
  :precision binary32
  (*
 (sqrt (* (- (fma maxCos ux 2.0) ux) (* ux (- 1.0 maxCos))))
 (sin (* PI (+ uy uy)))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((fmaf(maxCos, ux, 2.0f) - ux) * (ux * (1.0f - maxCos)))) * sinf((((float) M_PI) * (uy + uy)));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(fma(maxCos, ux, Float32(2.0)) - ux) * Float32(ux * Float32(Float32(1.0) - maxCos)))) * sin(Float32(Float32(pi) * Float32(uy + uy))))
end
\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(ux \cdot \left(1 - maxCos\right)\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right)
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. Step-by-step derivation
    1. lift--.f32N/A

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.1% accurate, 1.1× speedup?

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

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


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

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      8. lower-PI.f3289.0%

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

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

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

        \[\leadsto \left(uy \cdot \left(\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\pi}^{3}\right) + \color{blue}{2 \cdot \pi}\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      3. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

    if 0.0149999997 < uy

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{ux \cdot \left(2 - \color{blue}{ux}\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
    11. Applied rewrites92.2%

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

Alternative 4: 97.1% accurate, 1.2× speedup?

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

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


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

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      8. lower-PI.f3289.0%

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

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

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

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

        \[\leadsto \left(uy \cdot \left(2 \cdot \pi + \color{blue}{\frac{-4}{3} \cdot \left({uy}^{2} \cdot {\pi}^{3}\right)}\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      4. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

    if 0.0149999997 < uy

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{ux \cdot \left(2 - \color{blue}{ux}\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
    11. Applied rewrites92.2%

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

Alternative 5: 97.1% accurate, 1.2× speedup?

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

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


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

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      8. lower-PI.f3289.0%

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

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

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

    if 0.0149999997 < uy

    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{ux \cdot \left(2 - \color{blue}{ux}\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
    11. Applied rewrites92.2%

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

Alternative 6: 97.1% accurate, 1.1× speedup?

\[\sqrt{\left(2 - ux\right) \cdot \left(\left(\frac{ux}{maxCos} - ux\right) \cdot maxCos\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right) \]
(FPCore (ux uy maxCos)
  :precision binary32
  (*
 (sqrt (* (- 2.0 ux) (* (- (/ ux maxCos) ux) maxCos)))
 (sin (* PI (+ uy uy)))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((2.0f - ux) * (((ux / maxCos) - ux) * maxCos))) * sinf((((float) M_PI) * (uy + uy)));
}
function code(ux, uy, maxCos)
	return Float32(sqrt(Float32(Float32(Float32(2.0) - ux) * Float32(Float32(Float32(ux / maxCos) - ux) * maxCos))) * sin(Float32(Float32(pi) * Float32(uy + uy))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sqrt(((single(2.0) - ux) * (((ux / maxCos) - ux) * maxCos))) * sin((single(pi) * (uy + uy)));
end
\sqrt{\left(2 - ux\right) \cdot \left(\left(\frac{ux}{maxCos} - ux\right) \cdot maxCos\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right)
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. Step-by-step derivation
    1. lift--.f32N/A

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 97.0% accurate, 1.1× speedup?

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(2 - ux\right)} \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (*
     (sin (* (* uy 2.0) PI))
     (sqrt (* (- (- ux (* maxCos ux)) 0.0) (- 2.0 ux)))))
    float code(float ux, float uy, float maxCos) {
    	return sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((((ux - (maxCos * ux)) - 0.0f) * (2.0f - ux)));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(Float32(Float32(ux - Float32(maxCos * ux)) - Float32(0.0)) * Float32(Float32(2.0) - ux))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((((ux - (maxCos * ux)) - single(0.0)) * (single(2.0) - ux)));
    end
    
    \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(2 - ux\right)}
    
    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \color{blue}{\left(2 - ux\right)}} \]
    5. Step-by-step derivation
      1. lower--.f3297.1%

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

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

    Alternative 8: 96.9% accurate, 1.2× speedup?

    \[\sqrt{\mathsf{fma}\left(-2, maxCos, 2 - ux\right) \cdot ux} \cdot \sin \left(\left(uy + uy\right) \cdot \pi\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (* (sqrt (* (fma -2.0 maxCos (- 2.0 ux)) ux)) (sin (* (+ uy uy) PI))))
    float code(float ux, float uy, float maxCos) {
    	return sqrtf((fmaf(-2.0f, maxCos, (2.0f - ux)) * ux)) * sinf(((uy + uy) * ((float) M_PI)));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sqrt(Float32(fma(Float32(-2.0), maxCos, Float32(Float32(2.0) - ux)) * ux)) * sin(Float32(Float32(uy + uy) * Float32(pi))))
    end
    
    \sqrt{\mathsf{fma}\left(-2, maxCos, 2 - ux\right) \cdot ux} \cdot \sin \left(\left(uy + uy\right) \cdot \pi\right)
    
    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. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot ux\right) - 2 \cdot maxCos\right)} \]
      2. lower-*.f3296.9%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot ux\right) - 2 \cdot maxCos\right)} \]
    7. Applied rewrites96.9%

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

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

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

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

    Alternative 9: 89.1% accurate, 1.5× speedup?

    \[\sqrt{\left(\mathsf{fma}\left(ux, maxCos, 2\right) - ux\right) \cdot \left(ux - ux \cdot maxCos\right)} \cdot \left(\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -1.3333333333333333\right) \cdot \pi, \pi \cdot \pi, \pi + \pi\right) \cdot uy\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (*
     (sqrt (* (- (fma ux maxCos 2.0) ux) (- ux (* ux maxCos))))
     (*
      (fma (* (* (* uy uy) -1.3333333333333333) PI) (* PI PI) (+ PI PI))
      uy)))
    float code(float ux, float uy, float maxCos) {
    	return sqrtf(((fmaf(ux, maxCos, 2.0f) - ux) * (ux - (ux * maxCos)))) * (fmaf((((uy * uy) * -1.3333333333333333f) * ((float) M_PI)), (((float) M_PI) * ((float) M_PI)), (((float) M_PI) + ((float) M_PI))) * uy);
    }
    
    function code(ux, uy, maxCos)
    	return Float32(sqrt(Float32(Float32(fma(ux, maxCos, Float32(2.0)) - ux) * Float32(ux - Float32(ux * maxCos)))) * Float32(fma(Float32(Float32(Float32(uy * uy) * Float32(-1.3333333333333333)) * Float32(pi)), Float32(Float32(pi) * Float32(pi)), Float32(Float32(pi) + Float32(pi))) * uy))
    end
    
    \sqrt{\left(\mathsf{fma}\left(ux, maxCos, 2\right) - ux\right) \cdot \left(ux - ux \cdot maxCos\right)} \cdot \left(\mathsf{fma}\left(\left(\left(uy \cdot uy\right) \cdot -1.3333333333333333\right) \cdot \pi, \pi \cdot \pi, \pi + \pi\right) \cdot uy\right)
    
    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(uy \cdot \mathsf{fma}\left(\frac{-4}{3}, {uy}^{2} \cdot {\pi}^{3}, 2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{\left(\left(ux - maxCos \cdot ux\right) - 0\right) \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
      8. lower-PI.f3289.0%

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

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

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

    Alternative 10: 81.4% accurate, 2.4× speedup?

    \[2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)}\right)\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (*
     2.0
     (*
      uy
      (*
       PI
       (sqrt (* (- ux (* maxCos ux)) (- (+ 2.0 (* maxCos ux)) ux)))))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (uy * (((float) M_PI) * sqrtf(((ux - (maxCos * ux)) * ((2.0f + (maxCos * ux)) - ux)))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(Float32(ux - Float32(maxCos * ux)) * Float32(Float32(Float32(2.0) + Float32(maxCos * ux)) - ux))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (uy * (single(pi) * sqrt(((ux - (maxCos * ux)) * ((single(2.0) + (maxCos * ux)) - ux)))));
    end
    
    2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)}\right)\right)
    
    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. Step-by-step derivation
      1. lift--.f32N/A

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{1 \cdot 1} - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      4. sqr-neg-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)}\right)\right) \]
      11. lower-*.f3281.4%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(\left(2 + maxCos \cdot ux\right) - ux\right)}\right)\right) \]
    6. Applied rewrites81.4%

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

    Alternative 11: 65.9% accurate, 2.8× speedup?

    \[2 \cdot \left(uy \cdot \left(\pi \cdot \left(ux \cdot \sqrt{\frac{2 - 2 \cdot maxCos}{ux}}\right)\right)\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (* 2.0 (* uy (* PI (* ux (sqrt (/ (- 2.0 (* 2.0 maxCos)) ux)))))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (uy * (((float) M_PI) * (ux * sqrtf(((2.0f - (2.0f * maxCos)) / ux)))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * Float32(ux * sqrt(Float32(Float32(Float32(2.0) - Float32(Float32(2.0) * maxCos)) / ux))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (uy * (single(pi) * (ux * sqrt(((single(2.0) - (single(2.0) * maxCos)) / ux)))));
    end
    
    2 \cdot \left(uy \cdot \left(\pi \cdot \left(ux \cdot \sqrt{\frac{2 - 2 \cdot maxCos}{ux}}\right)\right)\right)
    
    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. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \color{blue}{\sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}}\right)\right) \]
    8. Taylor expanded in ux around inf

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(ux \cdot \sqrt{\frac{2 - 2 \cdot maxCos}{ux}}\right)\right)\right) \]
    9. Step-by-step derivation
      1. lower-*.f32N/A

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(ux \cdot \sqrt{\frac{2 - 2 \cdot maxCos}{ux}}\right)\right)\right) \]
      5. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(ux \cdot \sqrt{\frac{2 - 2 \cdot maxCos}{ux}}\right)\right)\right) \]
    10. Applied rewrites65.9%

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

    Alternative 12: 65.9% accurate, 3.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{\left(2 - 2 \cdot maxCos\right) \cdot ux}\right)\right) \]
      4. sqrt-prodN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{2 - 2 \cdot maxCos} \cdot \sqrt{ux}\right)\right)\right) \]
      9. fp-cancel-sub-sign-invN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos} \cdot \sqrt{ux}\right)\right)\right) \]
      10. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(2\right), maxCos, 2\right)} \cdot \sqrt{ux}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot \sqrt{ux}\right)\right)\right) \]
      13. lower-unsound-sqrt.f3265.9%

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

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

    Alternative 13: 65.9% accurate, 3.4× speedup?

    \[2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}\right)\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (* 2.0 (* uy (* PI (sqrt (* ux (- (- 2.0 maxCos) maxCos)))))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (uy * (((float) M_PI) * sqrtf((ux * ((2.0f - maxCos) - maxCos)))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(ux * Float32(Float32(Float32(2.0) - maxCos) - maxCos))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (uy * (single(pi) * sqrt((ux * ((single(2.0) - maxCos) - maxCos)))));
    end
    
    2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}\right)\right)
    
    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. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      3. count-2-revN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - \left(maxCos + maxCos\right)\right)}\right)\right) \]
      4. associate--r+N/A

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}\right)\right) \]
      6. lower--.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(\left(2 - maxCos\right) - maxCos\right)}\right)\right) \]
    9. Applied rewrites65.9%

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

    Alternative 14: 65.9% accurate, 3.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      2. pow1/2N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot {\left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right)}^{\frac{1}{2}}\right)\right) \]
      3. pow-to-expN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right) \cdot \frac{1}{2}}\right)\right) \]
      4. lower-unsound-exp.f32N/A

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right) \cdot \frac{1}{2}}\right)\right) \]
      6. lower-unsound-log.f3265.3%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right) \cdot 0.5}\right)\right) \]
      7. lift-*.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(ux \cdot \left(2 - 2 \cdot maxCos\right)\right) \cdot \frac{1}{2}}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(2 - 2 \cdot maxCos\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      9. lower-*.f3265.3%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(2 - 2 \cdot maxCos\right) \cdot ux\right) \cdot 0.5}\right)\right) \]
      10. lift--.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(2 - 2 \cdot maxCos\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      11. lift-*.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(2 - 2 \cdot maxCos\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(2 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\left(\left(\mathsf{neg}\left(2\right)\right) \cdot maxCos + 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      14. lower-fma.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\mathsf{fma}\left(\mathsf{neg}\left(2\right), maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right) \]
      15. metadata-eval65.3%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot 0.5}\right)\right) \]
    9. Applied rewrites65.3%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot 0.5}\right)\right) \]
    10. Step-by-step derivation
      1. lift-*.f32N/A

        \[\leadsto 2 \cdot \color{blue}{\left(uy \cdot \left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right)\right)} \]
      2. lift-*.f32N/A

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

        \[\leadsto \left(2 \cdot uy\right) \cdot \color{blue}{\left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right)} \]
      4. count-2N/A

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

        \[\leadsto \left(uy + uy\right) \cdot \left(\color{blue}{\pi} \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right) \]
      6. lower-*.f3265.3%

        \[\leadsto \left(uy + uy\right) \cdot \color{blue}{\left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot 0.5}\right)} \]
      7. lift-*.f32N/A

        \[\leadsto \left(uy + uy\right) \cdot \left(\pi \cdot e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(uy + uy\right) \cdot \left(e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot \frac{1}{2}} \cdot \pi\right) \]
      9. lower-*.f3265.3%

        \[\leadsto \left(uy + uy\right) \cdot \left(e^{\log \left(\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux\right) \cdot 0.5} \cdot \pi\right) \]
    11. Applied rewrites65.9%

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

    Alternative 15: 63.4% accurate, 4.0× speedup?

    \[2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (* 2.0 (* uy (* PI (* (sqrt ux) (sqrt 2.0))))))
    float code(float ux, float uy, float maxCos) {
    	return 2.0f * (uy * (((float) M_PI) * (sqrtf(ux) * sqrtf(2.0f))));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * Float32(sqrt(ux) * sqrt(Float32(2.0))))))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = single(2.0) * (uy * (single(pi) * (sqrt(ux) * sqrt(single(2.0)))));
    end
    
    2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right)
    
    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. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

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

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    9. Step-by-step derivation
      1. lower-sqrt.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
      2. lower-*.f3263.3%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    10. Applied rewrites63.3%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    11. Step-by-step derivation
      1. lift-sqrt.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
      2. lift-*.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot 2}\right)\right) \]
      4. sqrt-prodN/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right) \]
      5. lower-unsound-*.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right) \]
      6. lower-unsound-sqrt.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right) \]
      7. lower-unsound-sqrt.f3263.4%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \left(\sqrt{ux} \cdot \sqrt{2}\right)\right)\right) \]
    12. Applied rewrites63.4%

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

    Alternative 16: 63.3% accurate, 4.8× speedup?

    \[\left(uy + uy\right) \cdot \left(\sqrt{ux + ux} \cdot \pi\right) \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (* (+ uy uy) (* (sqrt (+ ux ux)) PI)))
    float code(float ux, float uy, float maxCos) {
    	return (uy + uy) * (sqrtf((ux + ux)) * ((float) M_PI));
    }
    
    function code(ux, uy, maxCos)
    	return Float32(Float32(uy + uy) * Float32(sqrt(Float32(ux + ux)) * Float32(pi)))
    end
    
    function tmp = code(ux, uy, maxCos)
    	tmp = (uy + uy) * (sqrt((ux + ux)) * single(pi));
    end
    
    \left(uy + uy\right) \cdot \left(\sqrt{ux + ux} \cdot \pi\right)
    
    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. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(\left(1 + maxCos \cdot ux\right) - ux\right)}^{2}}\right)\right) \]
    4. Applied rewrites50.3%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
      6. lower-*.f3265.9%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)\right) \]
    7. Applied rewrites65.9%

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

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    9. Step-by-step derivation
      1. lower-sqrt.f32N/A

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
      2. lower-*.f3263.3%

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    10. Applied rewrites63.3%

      \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right)\right) \]
    11. Step-by-step derivation
      1. lift-*.f32N/A

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

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

        \[\leadsto \left(2 \cdot uy\right) \cdot \color{blue}{\left(\pi \cdot \sqrt{2 \cdot ux}\right)} \]
      4. count-2N/A

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

        \[\leadsto \left(uy + uy\right) \cdot \left(\color{blue}{\pi} \cdot \sqrt{2 \cdot ux}\right) \]
      6. lower-*.f3263.3%

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

        \[\leadsto \left(uy + uy\right) \cdot \left(\pi \cdot \sqrt{2 \cdot ux}\right) \]
    12. Applied rewrites63.3%

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

    Reproduce

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