UniformSampleCone, y

Percentage Accurate: 57.5% → 98.3%
Time: 6.1s
Alternatives: 14
Speedup: 4.4×

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.5% 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, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\frac{ux \cdot ux - {\color{blue}{\left(maxCos \cdot ux\right)}}^{2}}{ux + maxCos \cdot ux} \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
    18. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\frac{ux \cdot ux - {\color{blue}{\left(maxCos \cdot ux\right)}}^{2}}{ux + maxCos \cdot ux} \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
    18. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \color{blue}{\left(\left(2 \cdot \pi\right) \cdot uy\right)} \cdot \sqrt{\mathsf{fma}\left(ux - maxCos \cdot ux, 2, \left(ux - maxCos \cdot ux\right) \cdot \left(maxCos \cdot ux - ux\right)\right)} \]
    6. count-2-revN/A

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

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\frac{ux \cdot ux - {\color{blue}{\left(maxCos \cdot ux\right)}}^{2}}{ux + maxCos \cdot ux} \cdot \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) - -1\right)} \]
    18. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.1% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.6% accurate, 1.2× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{ux \cdot \left(2 - 2 \cdot maxCos\right)}\\


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

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\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.4%

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

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

    if 2.99999992e-5 < maxCos

    1. Initial program 57.5%

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

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

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

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

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

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

Alternative 7: 95.0% accurate, 1.2× speedup?

\[\begin{array}{l} \mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\ \;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}\\ \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (if (<= maxCos 4.999999873689376e-5)
   (* (sin (* (* uy 2.0) PI)) (sqrt (* ux (- 2.0 ux))))
   (*
    (* 2.0 (* uy PI))
    (sqrt
     (*
      ux
      (- (+ 2.0 (* -1.0 (* ux (pow (- maxCos 1.0) 2.0)))) (* 2.0 maxCos)))))))
float code(float ux, float uy, float maxCos) {
	float tmp;
	if (maxCos <= 4.999999873689376e-5f) {
		tmp = sinf(((uy * 2.0f) * ((float) M_PI))) * sqrtf((ux * (2.0f - ux)));
	} else {
		tmp = (2.0f * (uy * ((float) M_PI))) * sqrtf((ux * ((2.0f + (-1.0f * (ux * powf((maxCos - 1.0f), 2.0f)))) - (2.0f * maxCos))));
	}
	return tmp;
}
function code(ux, uy, maxCos)
	tmp = Float32(0.0)
	if (maxCos <= Float32(4.999999873689376e-5))
		tmp = Float32(sin(Float32(Float32(uy * Float32(2.0)) * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(2.0) - ux))));
	else
		tmp = Float32(Float32(Float32(2.0) * Float32(uy * Float32(pi))) * sqrt(Float32(ux * Float32(Float32(Float32(2.0) + Float32(Float32(-1.0) * Float32(ux * (Float32(maxCos - Float32(1.0)) ^ Float32(2.0))))) - Float32(Float32(2.0) * maxCos)))));
	end
	return tmp
end
function tmp_2 = code(ux, uy, maxCos)
	tmp = single(0.0);
	if (maxCos <= single(4.999999873689376e-5))
		tmp = sin(((uy * single(2.0)) * single(pi))) * sqrt((ux * (single(2.0) - ux)));
	else
		tmp = (single(2.0) * (uy * single(pi))) * sqrt((ux * ((single(2.0) + (single(-1.0) * (ux * ((maxCos - single(1.0)) ^ single(2.0))))) - (single(2.0) * maxCos))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}
\mathbf{if}\;maxCos \leq 4.999999873689376 \cdot 10^{-5}:\\
\;\;\;\;\sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{ux \cdot \left(2 - ux\right)}\\

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


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

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{\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.4%

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

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

    if 4.99999987e-5 < maxCos

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.5% accurate, 2.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.6% accurate, 2.2× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right), ux - 1, 1\right)}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ux < 7.9999998e-5

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{maxCos \cdot \mathsf{fma}\left(-2, ux, 2 \cdot \frac{ux}{maxCos}\right)} \]
      4. lower-/.f3266.0%

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

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

    if 7.9999998e-5 < ux

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 66.0% accurate, 2.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{maxCos \cdot \mathsf{fma}\left(-2, ux, 2 \cdot \frac{ux}{maxCos}\right)} \]
    4. lower-/.f3266.0%

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

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

Alternative 11: 66.0% accurate, 3.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{ux \cdot \mathsf{fma}\left(maxCos, \color{blue}{\mathsf{neg}\left(2\right)}, 2\right)} \]
    7. metadata-eval66.0%

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

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

Alternative 12: 66.0% accurate, 3.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 63.5% accurate, 4.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 7.1% accurate, 4.7× speedup?

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

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \pi\right) \cdot \sqrt{1 - \color{blue}{1}} \]
  3. Step-by-step derivation
    1. Applied rewrites7.1%

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

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

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

        \[\leadsto \left(2 \cdot \left(uy \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt{1 - 1} \]
      3. lower-PI.f327.1%

        \[\leadsto \left(2 \cdot \left(uy \cdot \pi\right)\right) \cdot \sqrt{1 - 1} \]
    4. Applied rewrites7.1%

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

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

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

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

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

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

        \[\leadsto \left(\pi \cdot \color{blue}{\left(uy \cdot 2\right)}\right) \cdot \sqrt{1 - 1} \]
      7. lower-*.f327.1%

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

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

        \[\leadsto \left(\pi \cdot \left(2 \cdot \color{blue}{uy}\right)\right) \cdot \sqrt{1 - 1} \]
      10. count-2-revN/A

        \[\leadsto \left(\pi \cdot \left(uy + \color{blue}{uy}\right)\right) \cdot \sqrt{1 - 1} \]
      11. lower-+.f327.1%

        \[\leadsto \left(\pi \cdot \left(uy + \color{blue}{uy}\right)\right) \cdot \sqrt{1 - 1} \]
    6. Applied rewrites7.1%

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

    Reproduce

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