UniformSampleCone, y

Percentage Accurate: 57.4% → 98.3%
Time: 7.3s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 57.4% accurate, 1.0× speedup?

\[\begin{array}{l} 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?

\[\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(ux \cdot \left(maxCos + 2 \cdot \frac{1}{ux}\right) - ux\right)} \]
(FPCore (ux uy maxCos)
  :precision binary32
  (*
 (sin (* 2.0 (* uy PI)))
 (sqrt
  (*
   (- ux (* maxCos ux))
   (- (* ux (+ maxCos (* 2.0 (/ 1.0 ux)))) ux)))))
float code(float ux, float uy, float maxCos) {
	return sinf((2.0f * (uy * ((float) M_PI)))) * sqrtf(((ux - (maxCos * ux)) * ((ux * (maxCos + (2.0f * (1.0f / ux)))) - ux)));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))) * sqrt(Float32(Float32(ux - Float32(maxCos * ux)) * Float32(Float32(ux * Float32(maxCos + Float32(Float32(2.0) * Float32(Float32(1.0) / ux)))) - ux))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin((single(2.0) * (uy * single(pi)))) * sqrt(((ux - (maxCos * ux)) * ((ux * (maxCos + (single(2.0) * (single(1.0) / ux)))) - ux)));
end
\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(ux \cdot \left(maxCos + 2 \cdot \frac{1}{ux}\right) - ux\right)}
Derivation
  1. Initial program 57.4%

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. 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. 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)} \]
    3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. 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. 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)} \]
    3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 1.1× speedup?

\[\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(ux - maxCos \cdot ux\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))))
 (sin (* PI (+ uy uy)))))
float code(float ux, float uy, float maxCos) {
	return sqrtf(((fmaf(maxCos, ux, 2.0f) - ux) * (ux - (maxCos * ux)))) * 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(maxCos * ux)))) * sin(Float32(Float32(pi) * Float32(uy + uy))))
end
\sqrt{\left(\mathsf{fma}\left(maxCos, ux, 2\right) - ux\right) \cdot \left(ux - maxCos \cdot ux\right)} \cdot \sin \left(\pi \cdot \left(uy + uy\right)\right)
Derivation
  1. Initial program 57.4%

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. 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. 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)} \]
    3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.2% accurate, 1.2× speedup?

\[\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(2 - ux\right)} \]
(FPCore (ux uy maxCos)
  :precision binary32
  (* (sin (* 2.0 (* uy PI))) (sqrt (* (- ux (* maxCos ux)) (- 2.0 ux)))))
float code(float ux, float uy, float maxCos) {
	return sinf((2.0f * (uy * ((float) M_PI)))) * sqrtf(((ux - (maxCos * ux)) * (2.0f - ux)));
}
function code(ux, uy, maxCos)
	return Float32(sin(Float32(Float32(2.0) * Float32(uy * Float32(pi)))) * sqrt(Float32(Float32(ux - Float32(maxCos * ux)) * Float32(Float32(2.0) - ux))))
end
function tmp = code(ux, uy, maxCos)
	tmp = sin((single(2.0) * (uy * single(pi)))) * sqrt(((ux - (maxCos * ux)) * (single(2.0) - ux)));
end
\sin \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{\left(ux - maxCos \cdot ux\right) \cdot \left(2 - ux\right)}
Derivation
  1. Initial program 57.4%

    \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  2. 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. 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)} \]
    3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 95.5% accurate, 1.2× speedup?

    \[\begin{array}{l} t_0 := \pi \cdot \left(uy + uy\right)\\ \mathbf{if}\;maxCos \leq 6.000000212225132 \cdot 10^{-7}:\\ \;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot \sin t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \sqrt{\left(0 - \left(maxCos \cdot ux - ux\right)\right) \cdot \left(2 - \left(ux - maxCos \cdot ux\right)\right)}\\ \end{array} \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (let* ((t_0 (* PI (+ uy uy))))
      (if (<= maxCos 6.000000212225132e-7)
        (* (sqrt (* (- 2.0 ux) ux)) (sin t_0))
        (*
         t_0
         (sqrt
          (*
           (- 0.0 (- (* maxCos ux) ux))
           (- 2.0 (- ux (* maxCos ux)))))))))
    float code(float ux, float uy, float maxCos) {
    	float t_0 = ((float) M_PI) * (uy + uy);
    	float tmp;
    	if (maxCos <= 6.000000212225132e-7f) {
    		tmp = sqrtf(((2.0f - ux) * ux)) * sinf(t_0);
    	} else {
    		tmp = t_0 * sqrtf(((0.0f - ((maxCos * ux) - ux)) * (2.0f - (ux - (maxCos * ux)))));
    	}
    	return tmp;
    }
    
    function code(ux, uy, maxCos)
    	t_0 = Float32(Float32(pi) * Float32(uy + uy))
    	tmp = Float32(0.0)
    	if (maxCos <= Float32(6.000000212225132e-7))
    		tmp = Float32(sqrt(Float32(Float32(Float32(2.0) - ux) * ux)) * sin(t_0));
    	else
    		tmp = Float32(t_0 * sqrt(Float32(Float32(Float32(0.0) - Float32(Float32(maxCos * ux) - ux)) * Float32(Float32(2.0) - Float32(ux - Float32(maxCos * ux))))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(ux, uy, maxCos)
    	t_0 = single(pi) * (uy + uy);
    	tmp = single(0.0);
    	if (maxCos <= single(6.000000212225132e-7))
    		tmp = sqrt(((single(2.0) - ux) * ux)) * sin(t_0);
    	else
    		tmp = t_0 * sqrt(((single(0.0) - ((maxCos * ux) - ux)) * (single(2.0) - (ux - (maxCos * ux)))));
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    t_0 := \pi \cdot \left(uy + uy\right)\\
    \mathbf{if}\;maxCos \leq 6.000000212225132 \cdot 10^{-7}:\\
    \;\;\;\;\sqrt{\left(2 - ux\right) \cdot ux} \cdot \sin t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0 \cdot \sqrt{\left(0 - \left(maxCos \cdot ux - ux\right)\right) \cdot \left(2 - \left(ux - maxCos \cdot ux\right)\right)}\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if maxCos < 6.00000021e-7

      1. Initial program 57.4%

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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. 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)} \]
        3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}} \]
      5. 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(2 - ux\right)}} \]
        2. lower--.f3292.3%

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

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

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

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

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

      if 6.00000021e-7 < maxCos

      1. Initial program 57.4%

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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.2%

          \[\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.2%

        \[\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. Applied rewrites81.7%

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

    Alternative 6: 89.7% accurate, 1.3× speedup?

    \[\begin{array}{l} t_0 := ux - maxCos \cdot ux\\ \mathbf{if}\;uy \leq 0.002899999963119626:\\ \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-t\_0 \cdot \left(-2 + t\_0\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2}\\ \end{array} \]
    (FPCore (ux uy maxCos)
      :precision binary32
      (let* ((t_0 (- ux (* maxCos ux))))
      (if (<= uy 0.002899999963119626)
        (* 2.0 (* uy (* PI (sqrt (- (* t_0 (+ -2.0 t_0)))))))
        (* (sin (* (* uy 2.0) PI)) (sqrt (* ux 2.0))))))
    float code(float ux, float uy, float maxCos) {
    	float t_0 = ux - (maxCos * ux);
    	float tmp;
    	if (uy <= 0.002899999963119626f) {
    		tmp = 2.0f * (uy * (((float) M_PI) * sqrtf(-(t_0 * (-2.0f + t_0)))));
    	} else {
    		tmp = sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * 2.0f));
    	}
    	return tmp;
    }
    
    function code(ux, uy, maxCos)
    	t_0 = Float32(ux - Float32(maxCos * ux))
    	tmp = Float32(0.0)
    	if (uy <= Float32(0.002899999963119626))
    		tmp = Float32(Float32(2.0) * Float32(uy * Float32(Float32(pi) * sqrt(Float32(-Float32(t_0 * Float32(Float32(-2.0) + t_0)))))));
    	else
    		tmp = Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(2.0))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(ux, uy, maxCos)
    	t_0 = ux - (maxCos * ux);
    	tmp = single(0.0);
    	if (uy <= single(0.002899999963119626))
    		tmp = single(2.0) * (uy * (single(pi) * sqrt(-(t_0 * (single(-2.0) + t_0)))));
    	else
    		tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((ux * single(2.0)));
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    t_0 := ux - maxCos \cdot ux\\
    \mathbf{if}\;uy \leq 0.002899999963119626:\\
    \;\;\;\;2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-t\_0 \cdot \left(-2 + t\_0\right)}\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2}\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if uy < 0.00289999996

      1. Initial program 57.4%

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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.2%

          \[\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.2%

        \[\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. Step-by-step derivation
        1. lift--.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) \]
        2. lift-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) \]
        3. lift--.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) \]
        4. lift-+.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) \]
        5. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(1 - \left(ux - maxCos \cdot ux\right)\right)}^{2}}\right)\right) \]
        16. sub-square-powN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-\left(-2 \cdot \left(ux - maxCos \cdot ux\right) + \left(ux - maxCos \cdot ux\right) \cdot \left(ux - maxCos \cdot ux\right)\right)}\right)\right) \]
        15. distribute-rgt-outN/A

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

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

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

        \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-\left(ux - maxCos \cdot ux\right) \cdot \left(-2 + \left(ux - maxCos \cdot ux\right)\right)}\right)\right) \]

      if 0.00289999996 < uy

      1. Initial program 57.4%

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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. 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)} \]
        3. lift-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - ux\right)}} \]
      5. 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(2 - ux\right)}} \]
        2. lower--.f3292.3%

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2} \]
      8. Step-by-step derivation
        1. Applied rewrites72.8%

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot 2} \]
      9. Recombined 2 regimes into one program.
      10. Add Preprocessing

      Alternative 7: 81.7% accurate, 2.3× speedup?

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

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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.2%

          \[\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.2%

        \[\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. Step-by-step derivation
        1. lift--.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) \]
        2. lift-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) \]
        3. lift--.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) \]
        4. lift-+.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) \]
        5. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(1 - \left(ux - maxCos \cdot ux\right)\right)}^{2}}\right)\right) \]
        16. sub-square-powN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{-\left(-2 \cdot \left(ux - maxCos \cdot ux\right) + \left(ux - maxCos \cdot ux\right) \cdot \left(ux - maxCos \cdot ux\right)\right)}\right)\right) \]
        15. distribute-rgt-outN/A

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

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

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

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

      Alternative 8: 81.7% accurate, 2.4× speedup?

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

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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.2%

          \[\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.2%

        \[\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. Step-by-step derivation
        1. lift--.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) \]
        2. lift-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) \]
        3. lift--.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) \]
        4. lift-+.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) \]
        5. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(1 - \left(ux - maxCos \cdot ux\right)\right)}^{2}}\right)\right) \]
        16. sub-square-powN/A

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

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

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

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

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

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

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

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

      Alternative 9: 81.7% accurate, 2.4× speedup?

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

        \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      2. 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.2%

          \[\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.2%

        \[\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. Step-by-step derivation
        1. lift--.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) \]
        2. lift-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) \]
        3. lift--.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) \]
        4. lift-+.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) \]
        5. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - {\left(1 - \left(ux - maxCos \cdot ux\right)\right)}^{2}}\right)\right) \]
        16. sub-square-powN/A

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

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

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

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

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

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

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

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

      Alternative 10: 75.9% accurate, 1.5× speedup?

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

        1. Initial program 57.4%

          \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
        2. 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.2%

            \[\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.2%

          \[\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. Step-by-step derivation
          1. lift-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) \]
          2. lift--.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) \]
          3. lift-+.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) \]
          4. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \sqrt{1 - \left(1 - ux\right) \cdot \left(1 - ux\right)}\right)\right) \]
          3. Step-by-step derivation
            1. Applied rewrites48.9%

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

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

            1. Initial program 57.4%

              \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
            2. 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.2%

                \[\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.2%

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

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

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

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

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

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

                \[\leadsto 2 \cdot \color{blue}{\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 \color{blue}{\left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)}\right) \]
              3. associate-*r*N/A

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

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

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

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

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

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

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

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

          Alternative 11: 66.1% accurate, 3.5× speedup?

          \[\left(\left(uy + uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\right) \cdot \pi \]
          (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(Float32(uy + uy) * sqrt(Float32(fma(Float32(-2.0), maxCos, Float32(2.0)) * ux))) * Float32(pi))
          end
          
          \left(\left(uy + uy\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\right) \cdot \pi
          
          Derivation
          1. Initial program 57.4%

            \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
          2. 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.2%

              \[\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.2%

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

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

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

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

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

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

              \[\leadsto 2 \cdot \color{blue}{\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 \color{blue}{\left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)}\right) \]
            3. associate-*r*N/A

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

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

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

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

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

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

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

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

          Alternative 12: 66.1% accurate, 3.5× speedup?

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

            \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
          2. 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.2%

              \[\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.2%

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

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

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

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

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

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

              \[\leadsto 2 \cdot \color{blue}{\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 \color{blue}{\left(\pi \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\right)}\right) \]
            3. associate-*r*N/A

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

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

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

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

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

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

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

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

          Alternative 13: 63.4% accurate, 4.8× speedup?

          \[\left(\left(uy + uy\right) \cdot \sqrt{ux + ux}\right) \cdot \pi \]
          (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(Float32(uy + uy) * sqrt(Float32(ux + ux))) * Float32(pi))
          end
          
          function tmp = code(ux, uy, maxCos)
          	tmp = ((uy + uy) * sqrt((ux + ux))) * single(pi);
          end
          
          \left(\left(uy + uy\right) \cdot \sqrt{ux + ux}\right) \cdot \pi
          
          Derivation
          1. Initial program 57.4%

            \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
          2. 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.2%

              \[\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.2%

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

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

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

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

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

            \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \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-*.f3263.4%

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

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

          Alternative 14: 63.4% accurate, 4.8× speedup?

          \[\left(\pi \cdot \left(uy + uy\right)\right) \cdot \sqrt{ux + ux} \]
          (FPCore (ux uy maxCos)
            :precision binary32
            (* (* PI (+ uy uy)) (sqrt (+ ux ux))))
          float code(float ux, float uy, float maxCos) {
          	return (((float) M_PI) * (uy + uy)) * sqrtf((ux + ux));
          }
          
          function code(ux, uy, maxCos)
          	return Float32(Float32(Float32(pi) * Float32(uy + uy)) * sqrt(Float32(ux + ux)))
          end
          
          function tmp = code(ux, uy, maxCos)
          	tmp = (single(pi) * (uy + uy)) * sqrt((ux + ux));
          end
          
          \left(\pi \cdot \left(uy + uy\right)\right) \cdot \sqrt{ux + ux}
          
          Derivation
          1. Initial program 57.4%

            \[\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
          2. 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.2%

              \[\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.2%

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

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

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

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

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

            \[\leadsto 2 \cdot \left(uy \cdot \left(\pi \cdot \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-*.f3263.4%

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

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

          Reproduce

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