UniformSampleCone, x

Percentage Accurate: 57.8% → 98.8%
Time: 12.0s
Alternatives: 17
Speedup: 2.1×

Specification

?
\[\left(\left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq uy \land uy \leq 1\right)\right) \land \left(0 \leq maxCos \land maxCos \leq 1\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
   (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_0 t_0))))))
\begin{array}{l}

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
   (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_0 t_0))))))
\begin{array}{l}

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

Alternative 1: 98.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;maxCos \leq 5.999999976025183 \cdot 10^{-12}:\\ \;\;\;\;t\_0 \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \sqrt{\left(\left(maxCos \cdot maxCos\right) \cdot \left(\frac{\frac{2}{maxCos \cdot maxCos} - \frac{2}{maxCos}}{ux} + \left(\left(\frac{2}{maxCos} - 1\right) - \frac{1}{maxCos \cdot maxCos}\right)\right)\right) \cdot \left(ux \cdot ux\right)}\\ \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (cos (* (* uy 2.0) (PI)))))
   (if (<= maxCos 5.999999976025183e-12)
     (* t_0 (sqrt (* (* (- (/ 2.0 ux) 1.0) ux) ux)))
     (*
      t_0
      (sqrt
       (*
        (*
         (* maxCos maxCos)
         (+
          (/ (- (/ 2.0 (* maxCos maxCos)) (/ 2.0 maxCos)) ux)
          (- (- (/ 2.0 maxCos) 1.0) (/ 1.0 (* maxCos maxCos)))))
        (* ux ux)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;maxCos \leq 5.999999976025183 \cdot 10^{-12}:\\
\;\;\;\;t\_0 \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot ux}\\

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


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

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
      7. div-subN/A

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
      9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
      17. lower-*.f3271.5

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

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

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
    7. Step-by-step derivation
      1. Applied rewrites98.8%

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

      if 5.99999998e-12 < maxCos

      1. Initial program 62.9%

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

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

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

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

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

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

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

          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
        7. div-subN/A

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

          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
        9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
        17. lower-*.f3261.6

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
      7. Step-by-step derivation
        1. Applied rewrites98.7%

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

          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \left({maxCos}^{2} \cdot \left(2 \cdot \frac{1}{maxCos} - \left(1 + \frac{1}{{maxCos}^{2}}\right)\right) + \color{blue}{\frac{{maxCos}^{2} \cdot \left(2 \cdot \frac{1}{{maxCos}^{2}} - 2 \cdot \frac{1}{maxCos}\right)}{ux}}\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites98.9%

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

        Alternative 2: 70.6% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \leq 0.023499999195337296:\\ \;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0}\\ \end{array} \end{array} \]
        (FPCore (ux uy maxCos)
         :precision binary32
         (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))))
           (if (<=
                (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_0 t_0))))
                0.023499999195337296)
             (* (cos (* (* (PI) uy) -2.0)) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
             (*
              (+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))
              (sqrt (- 1.0 (* (- 1.0 (- ux (* ux maxCos))) t_0)))))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
        \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \leq 0.023499999195337296:\\
        \;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f32 (cos.f32 (*.f32 (*.f32 uy #s(literal 2 binary32)) (PI.f32))) (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)))))) < 0.0234999992

          1. Initial program 42.7%

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

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

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

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

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

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

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

              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
            7. div-subN/A

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

              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
            9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}} \]
          6. Step-by-step derivation
            1. Applied rewrites98.7%

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

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

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

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

                \[\leadsto \cos \left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
              5. associate-*l*N/A

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

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

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

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

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

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

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

                \[\leadsto \cos \left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}} \cdot \left(uy \cdot 2\right)\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
              13. lower-cbrt.f3298.5

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

              \[\leadsto \cos \color{blue}{\left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \left(uy \cdot 2\right)\right)\right)} \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
            4. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{ux \cdot \left(2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos\right)} \]
              14. fp-cancel-sign-sub-invN/A

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

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

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

                \[\leadsto \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\color{blue}{\left(-2 \cdot maxCos + 2\right)} \cdot ux} \]
              18. lower-fma.f3262.3

                \[\leadsto \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot ux} \]
            6. Applied rewrites62.3%

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

            if 0.0234999992 < (*.f32 (cos.f32 (*.f32 (*.f32 uy #s(literal 2 binary32)) (PI.f32))) (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))))

            1. Initial program 89.8%

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

              \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
              1. +-commutativeN/A

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

                \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites84.7%

                \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Step-by-step derivation
                1. lift-+.f32N/A

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

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

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

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

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

                \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\left(1 - \left(ux - ux \cdot maxCos\right)\right)} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
            7. Recombined 2 regimes into one program.
            8. Final simplification70.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \leq 0.023499999195337296:\\ \;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\\ \end{array} \]
            9. Add Preprocessing

            Alternative 3: 98.8% accurate, 0.6× speedup?

            \[\begin{array}{l} \\ \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \end{array} \]
            (FPCore (ux uy maxCos)
             :precision binary32
             (*
              (cos (* (* uy 2.0) (PI)))
              (sqrt
               (* (- (/ (- 2.0 (* 2.0 maxCos)) ux) (pow (- maxCos 1.0) 2.0)) (* ux ux)))))
            \begin{array}{l}
            
            \\
            \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}
            \end{array}
            
            Derivation
            1. Initial program 59.5%

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

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

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

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

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

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

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

                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
              7. div-subN/A

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

                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
              9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
              17. lower-*.f3268.6

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

              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}} \]
            6. Step-by-step derivation
              1. Applied rewrites98.8%

                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
              2. Add Preprocessing

              Alternative 4: 67.4% accurate, 0.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ t_1 := \left(uy \cdot uy\right) \cdot -2\\ \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \leq 0.023499999195337296:\\ \;\;\;\;\left(1 + \left(t\_1 \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\ \end{array} \end{array} \]
              (FPCore (ux uy maxCos)
               :precision binary32
               (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (* (* uy uy) -2.0)))
                 (if (<=
                      (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* t_0 t_0))))
                      0.023499999195337296)
                   (* (+ 1.0 (* (* t_1 (PI)) (PI))) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                   (* (fma t_1 (* (PI) (PI)) 1.0) (sqrt (- 1.0 (* t_0 (- 1.0 ux))))))))
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
              t_1 := \left(uy \cdot uy\right) \cdot -2\\
              \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0} \leq 0.023499999195337296:\\
              \;\;\;\;\left(1 + \left(t\_1 \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f32 (cos.f32 (*.f32 (*.f32 uy #s(literal 2 binary32)) (PI.f32))) (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)))))) < 0.0234999992

                1. Initial program 42.7%

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

                  \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                  1. +-commutativeN/A

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

                    \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites38.1%

                    \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in ux around 0

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

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

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

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

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

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

                      \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot ux} \]
                  4. Applied rewrites67.8%

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

                  if 0.0234999992 < (*.f32 (cos.f32 (*.f32 (*.f32 uy #s(literal 2 binary32)) (PI.f32))) (sqrt.f32 (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos))))))

                  1. Initial program 89.8%

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

                    \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                    1. +-commutativeN/A

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

                      \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \leq 0.023499999195337296:\\ \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\ \end{array} \]
                9. Add Preprocessing

                Alternative 5: 98.6% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{ux} - 1\\ t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;maxCos \leq 5.000000018137469 \cdot 10^{-16}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{2 - \frac{2}{ux}}{maxCos} + \frac{t\_0}{maxCos \cdot maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\ \end{array} \end{array} \]
                (FPCore (ux uy maxCos)
                 :precision binary32
                 (let* ((t_0 (- (/ 2.0 ux) 1.0)) (t_1 (cos (* (* uy 2.0) (PI)))))
                   (if (<= maxCos 5.000000018137469e-16)
                     (* t_1 (sqrt (* (* t_0 ux) ux)))
                     (*
                      t_1
                      (sqrt
                       (*
                        (-
                         (*
                          (* ux ux)
                          (+ (/ (- 2.0 (/ 2.0 ux)) maxCos) (/ t_0 (* maxCos maxCos))))
                         (* ux ux))
                        (* maxCos maxCos)))))))
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{2}{ux} - 1\\
                t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
                \mathbf{if}\;maxCos \leq 5.000000018137469 \cdot 10^{-16}:\\
                \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1 \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{2 - \frac{2}{ux}}{maxCos} + \frac{t\_0}{maxCos \cdot maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if maxCos < 5.00000002e-16

                  1. Initial program 58.0%

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

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

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

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

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

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

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                    7. div-subN/A

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                    9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                    17. lower-*.f3274.0

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

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

                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                  7. Step-by-step derivation
                    1. Applied rewrites98.8%

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                    if 5.00000002e-16 < maxCos

                    1. Initial program 61.6%

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

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

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

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

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

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

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

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                      7. div-subN/A

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

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                      9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                      17. lower-*.f3260.5

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}} \]
                    6. Step-by-step derivation
                      1. Applied rewrites99.0%

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                      2. Taylor expanded in maxCos around inf

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites98.8%

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

                      Alternative 6: 98.7% accurate, 0.7× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{ux} - 1\\ t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;maxCos \leq 5.00000006675716 \cdot 10^{-11}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot \left(ux \cdot ux\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\ \end{array} \end{array} \]
                      (FPCore (ux uy maxCos)
                       :precision binary32
                       (let* ((t_0 (- (/ 2.0 ux) 1.0)) (t_1 (cos (* (* uy 2.0) (PI)))))
                         (if (<= maxCos 5.00000006675716e-11)
                           (* t_1 (sqrt (* (* t_0 ux) ux)))
                           (*
                            t_1
                            (sqrt
                             (*
                              (-
                               (* (/ (- (+ (/ t_0 maxCos) 2.0) (/ 2.0 ux)) maxCos) (* ux ux))
                               (* ux ux))
                              (* maxCos maxCos)))))))
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := \frac{2}{ux} - 1\\
                      t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
                      \mathbf{if}\;maxCos \leq 5.00000006675716 \cdot 10^{-11}:\\
                      \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_1 \cdot \sqrt{\left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot \left(ux \cdot ux\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if maxCos < 5.00000007e-11

                        1. Initial program 58.6%

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

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

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

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

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

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

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

                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                          7. div-subN/A

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

                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                          9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                          17. lower-*.f3271.3

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

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

                          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                        7. Step-by-step derivation
                          1. Applied rewrites98.8%

                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                          if 5.00000007e-11 < maxCos

                          1. Initial program 61.6%

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

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

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

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

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

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

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

                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                            7. div-subN/A

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

                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                            9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                            17. lower-*.f3261.2

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

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

                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
                          7. Step-by-step derivation
                            1. Applied rewrites98.7%

                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{\frac{2}{ux} - 1}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \color{blue}{\left(maxCos \cdot maxCos\right)}} \]
                            2. Step-by-step derivation
                              1. Applied rewrites98.6%

                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\left(\frac{\frac{2}{ux} - 1}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot \left(ux \cdot ux\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)} \]
                            3. Recombined 2 regimes into one program.
                            4. Add Preprocessing

                            Alternative 7: 98.7% accurate, 0.7× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{ux} - 1\\ \mathbf{if}\;maxCos \leq 5.00000006675716 \cdot 10^{-11}:\\ \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right)} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right)\\ \end{array} \end{array} \]
                            (FPCore (ux uy maxCos)
                             :precision binary32
                             (let* ((t_0 (- (/ 2.0 ux) 1.0)))
                               (if (<= maxCos 5.00000006675716e-11)
                                 (* (cos (* (* uy 2.0) (PI))) (sqrt (* (* t_0 ux) ux)))
                                 (*
                                  (sqrt
                                   (*
                                    (* maxCos maxCos)
                                    (* ux (- (* (/ (- (+ (/ t_0 maxCos) 2.0) (/ 2.0 ux)) maxCos) ux) ux))))
                                  (cos (* (PI) (* uy 2.0)))))))
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \frac{2}{ux} - 1\\
                            \mathbf{if}\;maxCos \leq 5.00000006675716 \cdot 10^{-11}:\\
                            \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right)} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right)\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if maxCos < 5.00000007e-11

                              1. Initial program 58.6%

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

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

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

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

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

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

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

                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                7. div-subN/A

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

                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                17. lower-*.f3271.3

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

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

                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites98.8%

                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                                if 5.00000007e-11 < maxCos

                                1. Initial program 61.6%

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

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

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

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

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

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

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

                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                  7. div-subN/A

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

                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                  9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                  17. lower-*.f3261.2

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

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

                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites98.7%

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

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

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

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

                                    \[\leadsto \color{blue}{\sqrt{\left(maxCos \cdot maxCos\right) \cdot \left(ux \cdot \left(\frac{\left(\frac{\frac{2}{ux} - 1}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right)} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(uy \cdot 2\right)\right)} \]
                                8. Recombined 2 regimes into one program.
                                9. Add Preprocessing

                                Alternative 8: 98.7% accurate, 0.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{ux} - 1\\ t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;maxCos \leq 3.999999984016789 \cdot 10^{-11}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sqrt{\left(\left(ux \cdot \left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right) \cdot maxCos\right) \cdot maxCos}\\ \end{array} \end{array} \]
                                (FPCore (ux uy maxCos)
                                 :precision binary32
                                 (let* ((t_0 (- (/ 2.0 ux) 1.0)) (t_1 (cos (* (* uy 2.0) (PI)))))
                                   (if (<= maxCos 3.999999984016789e-11)
                                     (* t_1 (sqrt (* (* t_0 ux) ux)))
                                     (*
                                      t_1
                                      (sqrt
                                       (*
                                        (*
                                         (* ux (- (* (/ (- (+ (/ t_0 maxCos) 2.0) (/ 2.0 ux)) maxCos) ux) ux))
                                         maxCos)
                                        maxCos))))))
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \frac{2}{ux} - 1\\
                                t_1 := \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)\\
                                \mathbf{if}\;maxCos \leq 3.999999984016789 \cdot 10^{-11}:\\
                                \;\;\;\;t\_1 \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_1 \cdot \sqrt{\left(\left(ux \cdot \left(\frac{\left(\frac{t\_0}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right) \cdot maxCos\right) \cdot maxCos}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if maxCos < 3.99999998e-11

                                  1. Initial program 58.6%

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

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

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

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

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

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

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

                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                    7. div-subN/A

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

                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                    9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                    17. lower-*.f3271.2

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

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

                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites98.8%

                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                                    if 3.99999998e-11 < maxCos

                                    1. Initial program 61.6%

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

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

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

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

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

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

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

                                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                      7. div-subN/A

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

                                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                      9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                      17. lower-*.f3261.8

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

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

                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites98.7%

                                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{\frac{2}{ux} - 1}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \color{blue}{\left(maxCos \cdot maxCos\right)}} \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites98.5%

                                          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(ux \cdot \left(\frac{\left(\frac{\frac{2}{ux} - 1}{maxCos} + 2\right) - \frac{2}{ux}}{maxCos} \cdot ux - ux\right)\right) \cdot maxCos\right) \cdot maxCos} \]
                                      3. Recombined 2 regimes into one program.
                                      4. Add Preprocessing

                                      Alternative 9: 96.0% accurate, 0.9× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;maxCos \leq 1.2000000424450263 \cdot 10^{-5}:\\ \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}\\ \end{array} \end{array} \]
                                      (FPCore (ux uy maxCos)
                                       :precision binary32
                                       (if (<= maxCos 1.2000000424450263e-5)
                                         (* (cos (* (* uy 2.0) (PI))) (sqrt (* (* (- (/ 2.0 ux) 1.0) ux) ux)))
                                         (*
                                          (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
                                          (sqrt
                                           (*
                                            (- (/ (- 2.0 (* 2.0 maxCos)) ux) (pow (- maxCos 1.0) 2.0))
                                            (* ux ux))))))
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;maxCos \leq 1.2000000424450263 \cdot 10^{-5}:\\
                                      \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot ux}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if maxCos < 1.20000004e-5

                                        1. Initial program 58.7%

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

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

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

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

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

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

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

                                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                          7. div-subN/A

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

                                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                          9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                          17. lower-*.f3272.7

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

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

                                          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites98.3%

                                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                                          if 1.20000004e-5 < maxCos

                                          1. Initial program 63.6%

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

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

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

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

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

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

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

                                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                            7. div-subN/A

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

                                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                            9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                            17. lower-*.f3244.2

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

                                            \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}} \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites98.9%

                                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                            2. Taylor expanded in uy around 0

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                              11. lower-PI.f3285.0

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

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                          7. Recombined 2 regimes into one program.
                                          8. Add Preprocessing

                                          Alternative 10: 95.9% accurate, 1.0× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{ux} - 1\\ \mathbf{if}\;maxCos \leq 1.2000000424450263 \cdot 10^{-5}:\\ \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{t\_0}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\ \end{array} \end{array} \]
                                          (FPCore (ux uy maxCos)
                                           :precision binary32
                                           (let* ((t_0 (- (/ 2.0 ux) 1.0)))
                                             (if (<= maxCos 1.2000000424450263e-5)
                                               (* (cos (* (* uy 2.0) (PI))) (sqrt (* (* t_0 ux) ux)))
                                               (*
                                                (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
                                                (sqrt
                                                 (*
                                                  (-
                                                   (*
                                                    (* ux ux)
                                                    (+ (/ (/ t_0 maxCos) maxCos) (/ (- 2.0 (/ 2.0 ux)) maxCos)))
                                                   (* ux ux))
                                                  (* maxCos maxCos)))))))
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \frac{2}{ux} - 1\\
                                          \mathbf{if}\;maxCos \leq 1.2000000424450263 \cdot 10^{-5}:\\
                                          \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(t\_0 \cdot ux\right) \cdot ux}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{t\_0}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)}\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if maxCos < 1.20000004e-5

                                            1. Initial program 58.7%

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

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

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

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

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

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

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

                                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                              7. div-subN/A

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

                                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                              9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                              17. lower-*.f3272.7

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

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

                                              \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{ux}^{2} \cdot \color{blue}{\left(2 \cdot \frac{1}{ux} - 1\right)}} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites98.3%

                                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - 1\right) \cdot ux\right) \cdot \color{blue}{ux}} \]

                                              if 1.20000004e-5 < maxCos

                                              1. Initial program 63.6%

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

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

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

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

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

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

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

                                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                                7. div-subN/A

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

                                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                                9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                                17. lower-*.f3244.2

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

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

                                                \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{{maxCos}^{2} \cdot \color{blue}{\left(-1 \cdot {ux}^{2} + \left(\frac{{ux}^{2} \cdot \left(2 - 2 \cdot \frac{1}{ux}\right)}{maxCos} + \frac{{ux}^{2} \cdot \left(2 \cdot \frac{1}{ux} - 1\right)}{{maxCos}^{2}}\right)\right)}} \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{\left(\left(ux \cdot ux\right) \cdot \left(\frac{\frac{\frac{2}{ux} - 1}{maxCos}}{maxCos} + \frac{2 - \frac{2}{ux}}{maxCos}\right) - ux \cdot ux\right) \cdot \left(maxCos \cdot maxCos\right)} \]
                                              8. Recombined 2 regimes into one program.
                                              9. Add Preprocessing

                                              Alternative 11: 73.7% accurate, 1.0× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ux \leq 9.000000136438757 \cdot 10^{-5}:\\ \;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\ \end{array} \end{array} \]
                                              (FPCore (ux uy maxCos)
                                               :precision binary32
                                               (if (<= ux 9.000000136438757e-5)
                                                 (* (cos (* (* (PI) uy) -2.0)) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                                                 (*
                                                  (cos (* (* uy 2.0) (PI)))
                                                  (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (- 1.0 ux)))))))
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;ux \leq 9.000000136438757 \cdot 10^{-5}:\\
                                              \;\;\;\;\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if ux < 9.00000014e-5

                                                1. Initial program 38.1%

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

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

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

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

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

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

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

                                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\left(\frac{2}{ux} - \color{blue}{\frac{2 \cdot maxCos}{ux}}\right) - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                                  7. div-subN/A

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

                                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                                  9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \color{blue}{\left(ux \cdot ux\right)}} \]
                                                  17. lower-*.f3269.0

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

                                                  \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(-2, maxCos, 2\right)}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)}} \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites98.8%

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

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

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

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

                                                      \[\leadsto \cos \left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot \left(uy \cdot 2\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                                    5. associate-*l*N/A

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

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

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

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

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

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

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

                                                      \[\leadsto \cos \left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}} \cdot \left(uy \cdot 2\right)\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                                    13. lower-cbrt.f3298.7

                                                      \[\leadsto \cos \left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(\color{blue}{\sqrt[3]{\mathsf{PI}\left(\right)}} \cdot \left(uy \cdot 2\right)\right)\right) \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                                  3. Applied rewrites98.7%

                                                    \[\leadsto \cos \color{blue}{\left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \left(uy \cdot 2\right)\right)\right)} \cdot \sqrt{\left(\frac{2 - 2 \cdot maxCos}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot \left(ux \cdot ux\right)} \]
                                                  4. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{ux \cdot \left(2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos\right)} \]
                                                    14. fp-cancel-sign-sub-invN/A

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

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

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

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

                                                      \[\leadsto \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot ux} \]
                                                  6. Applied rewrites65.8%

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

                                                  if 9.00000014e-5 < ux

                                                  1. Initial program 87.4%

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

                                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                                                  4. Step-by-step derivation
                                                    1. lower--.f3281.7

                                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                                                  5. Applied rewrites81.7%

                                                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                                                7. Recombined 2 regimes into one program.
                                                8. Add Preprocessing

                                                Alternative 12: 71.5% accurate, 1.5× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ t_1 := 1 - t\_0 \cdot t\_0\\ \mathbf{if}\;t\_1 \leq 0.00018000000272877514:\\ \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \left(\left(\left(uy \cdot uy\right) \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{t\_1}\\ \end{array} \end{array} \]
                                                (FPCore (ux uy maxCos)
                                                 :precision binary32
                                                 (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos))) (t_1 (- 1.0 (* t_0 t_0))))
                                                   (if (<= t_1 0.00018000000272877514)
                                                     (*
                                                      (+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))
                                                      (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                                                     (* (- 1.0 (* (* (* (* uy uy) 2.0) (PI)) (PI))) (sqrt t_1)))))
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
                                                t_1 := 1 - t\_0 \cdot t\_0\\
                                                \mathbf{if}\;t\_1 \leq 0.00018000000272877514:\\
                                                \;\;\;\;\left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left(1 - \left(\left(\left(uy \cdot uy\right) \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{t\_1}\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)))) < 1.80000003e-4

                                                  1. Initial program 38.1%

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

                                                    \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                    1. +-commutativeN/A

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

                                                      \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites36.6%

                                                      \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

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

                                                    1. Initial program 87.4%

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

                                                      \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                      1. +-commutativeN/A

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

                                                        \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                    6. Step-by-step derivation
                                                      1. Applied rewrites78.2%

                                                        \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Step-by-step derivation
                                                        1. Applied rewrites78.2%

                                                          \[\leadsto \left(1 - \left(\left(\left(uy \cdot uy\right) \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Recombined 2 regimes into one program.
                                                      4. Final simplification78.4%

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

                                                      Alternative 13: 70.2% accurate, 1.6× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ t_1 := 1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;1 - t\_0 \cdot t\_0 \leq 0.00018000000272877514:\\ \;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\ \end{array} \end{array} \]
                                                      (FPCore (ux uy maxCos)
                                                       :precision binary32
                                                       (let* ((t_0 (+ (- 1.0 ux) (* ux maxCos)))
                                                              (t_1 (+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))))
                                                         (if (<= (- 1.0 (* t_0 t_0)) 0.00018000000272877514)
                                                           (* t_1 (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                                                           (* t_1 (sqrt (- 1.0 (* t_0 (- 1.0 ux))))))))
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      t_0 := \left(1 - ux\right) + ux \cdot maxCos\\
                                                      t_1 := 1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\\
                                                      \mathbf{if}\;1 - t\_0 \cdot t\_0 \leq 0.00018000000272877514:\\
                                                      \;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;t\_1 \cdot \sqrt{1 - t\_0 \cdot \left(1 - ux\right)}\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if (-.f32 #s(literal 1 binary32) (*.f32 (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)))) < 1.80000003e-4

                                                        1. Initial program 38.1%

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

                                                          \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                          1. +-commutativeN/A

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

                                                            \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                        6. Step-by-step derivation
                                                          1. Applied rewrites36.6%

                                                            \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in ux around 0

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

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

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

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

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

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

                                                              \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot ux} \]
                                                          4. Applied rewrites74.0%

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

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

                                                          1. Initial program 87.4%

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

                                                            \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                            1. +-commutativeN/A

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

                                                              \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                          6. Step-by-step derivation
                                                            1. Applied rewrites78.2%

                                                              \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in maxCos around 0

                                                              \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                                                            3. Step-by-step derivation
                                                              1. lower--.f3273.3

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

                                                              \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                                                          7. Recombined 2 regimes into one program.
                                                          8. Final simplification76.3%

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

                                                          Alternative 14: 71.6% accurate, 2.1× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;ux \leq 9.000000136438757 \cdot 10^{-5}:\\ \;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\\ \end{array} \end{array} \]
                                                          (FPCore (ux uy maxCos)
                                                           :precision binary32
                                                           (let* ((t_0 (+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))))
                                                             (if (<= ux 9.000000136438757e-5)
                                                               (* t_0 (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                                                               (*
                                                                t_0
                                                                (sqrt
                                                                 (-
                                                                  1.0
                                                                  (* (- 1.0 (- ux (* ux maxCos))) (+ (- 1.0 ux) (* ux maxCos)))))))))
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          t_0 := 1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\\
                                                          \mathbf{if}\;ux \leq 9.000000136438757 \cdot 10^{-5}:\\
                                                          \;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;t\_0 \cdot \sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if ux < 9.00000014e-5

                                                            1. Initial program 38.1%

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

                                                              \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                              1. +-commutativeN/A

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

                                                                \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                            6. Step-by-step derivation
                                                              1. Applied rewrites36.6%

                                                                \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in ux around 0

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

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

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

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

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

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

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

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

                                                              if 9.00000014e-5 < ux

                                                              1. Initial program 87.4%

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

                                                                \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                                1. +-commutativeN/A

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

                                                                  \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites78.2%

                                                                  \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Step-by-step derivation
                                                                  1. lift-+.f32N/A

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

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

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

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

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

                                                                  \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\left(1 - \left(ux - ux \cdot maxCos\right)\right)} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                              7. Recombined 2 regimes into one program.
                                                              8. Final simplification78.2%

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

                                                              Alternative 15: 55.7% accurate, 3.1× speedup?

                                                              \[\begin{array}{l} \\ \left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \end{array} \]
                                                              (FPCore (ux uy maxCos)
                                                               :precision binary32
                                                               (*
                                                                (+ 1.0 (* (* (* (* uy uy) -2.0) (PI)) (PI)))
                                                                (sqrt (* (fma -2.0 maxCos 2.0) ux))))
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \left(1 + \left(\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 59.5%

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

                                                                \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                                1. +-commutativeN/A

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

                                                                  \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites54.6%

                                                                  \[\leadsto \left(1 - \color{blue}{\left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\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. Taylor expanded in ux around 0

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

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

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

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

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

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

                                                                    \[\leadsto \left(1 - \left(-\left(\left(uy \cdot uy\right) \cdot -2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-2, maxCos, 2\right)} \cdot ux} \]
                                                                4. Applied rewrites65.0%

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

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

                                                                Alternative 16: 55.3% accurate, 3.3× speedup?

                                                                \[\begin{array}{l} \\ \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \end{array} \]
                                                                (FPCore (ux uy maxCos)
                                                                 :precision binary32
                                                                 (*
                                                                  (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0)
                                                                  (sqrt (* (fma -2.0 maxCos 2.0) ux))))
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 59.5%

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

                                                                  \[\leadsto \color{blue}{\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\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. Step-by-step derivation
                                                                  1. +-commutativeN/A

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

                                                                    \[\leadsto \left(\color{blue}{\left(-2 \cdot {uy}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + 1\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-fma.f32N/A

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

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

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

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

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

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

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

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

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

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

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

                                                                    \[\leadsto \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{ux \cdot \left(2 - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot maxCos\right)} \]
                                                                  2. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                                  \[\leadsto \left(-2 \cdot \color{blue}{\left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \]
                                                                10. Step-by-step derivation
                                                                  1. Applied rewrites4.7%

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

                                                                    \[\leadsto \left({uy}^{2} \cdot \color{blue}{\left(-2 \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{{uy}^{2}}\right)}\right) \cdot \sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites61.3%

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

                                                                    Alternative 17: 6.6% accurate, 3.5× speedup?

                                                                    \[\begin{array}{l} \\ \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - 1 \cdot 1} \end{array} \]
                                                                    (FPCore (ux uy maxCos)
                                                                     :precision binary32
                                                                     (* (fma (* (* uy uy) -2.0) (* (PI) (PI)) 1.0) (sqrt (- 1.0 (* 1.0 1.0)))))
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - 1 \cdot 1}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 59.5%

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

                                                                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{1}} \]
                                                                    4. Step-by-step derivation
                                                                      1. Applied rewrites27.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                        \[\leadsto \mathsf{fma}\left(\left(uy \cdot uy\right) \cdot -2, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right) \cdot \sqrt{1 - \color{blue}{1} \cdot 1} \]
                                                                      6. Step-by-step derivation
                                                                        1. Applied rewrites6.6%

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

                                                                        Reproduce

                                                                        ?
                                                                        herbie shell --seed 2024326 
                                                                        (FPCore (ux uy maxCos)
                                                                          :name "UniformSampleCone, x"
                                                                          :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)))
                                                                          (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))