UniformSampleCone, x

Percentage Accurate: 57.6% → 99.0%
Time: 12.5s
Alternatives: 13
Speedup: 5.8×

Specification

?
\[\left(\left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq uy \land uy \leq 1\right)\right) \land \left(0 \leq maxCos \land maxCos \leq 1\right)\]
\[\begin{array}{l} \\ \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 13 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.6% 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: 99.0% accurate, 0.6× speedup?

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

\\
\sqrt{\left(\left(2 - ux \cdot {\left(maxCos - 1\right)}^{2}\right) - maxCos \cdot 2\right) \cdot ux} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)
\end{array}
Derivation
  1. Initial program 55.3%

    \[\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 inf

    \[\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(maxCos \cdot \left(\left(ux + \frac{1}{maxCos}\right) - \frac{ux}{maxCos}\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{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(\left(\left(ux + \frac{1}{maxCos}\right) - \frac{ux}{maxCos}\right) \cdot maxCos\right)}} \]
    2. lower-*.f32N/A

      \[\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(\left(\left(ux + \frac{1}{maxCos}\right) - \frac{ux}{maxCos}\right) \cdot maxCos\right)}} \]
    3. associate--l+N/A

      \[\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 \left(\color{blue}{\left(ux + \left(\frac{1}{maxCos} - \frac{ux}{maxCos}\right)\right)} \cdot maxCos\right)} \]
    4. div-subN/A

      \[\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 \left(\left(ux + \color{blue}{\frac{1 - ux}{maxCos}}\right) \cdot maxCos\right)} \]
    5. +-commutativeN/A

      \[\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 \left(\color{blue}{\left(\frac{1 - ux}{maxCos} + ux\right)} \cdot maxCos\right)} \]
    6. lower-+.f32N/A

      \[\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 \left(\color{blue}{\left(\frac{1 - ux}{maxCos} + ux\right)} \cdot maxCos\right)} \]
    7. lower-/.f32N/A

      \[\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 \left(\left(\color{blue}{\frac{1 - ux}{maxCos}} + ux\right) \cdot maxCos\right)} \]
    8. lower--.f3255.3

      \[\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 \left(\left(\frac{\color{blue}{1 - ux}}{maxCos} + ux\right) \cdot maxCos\right)} \]
  5. Applied rewrites55.3%

    \[\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(\left(\frac{1 - ux}{maxCos} + ux\right) \cdot maxCos\right)}} \]
  6. Step-by-step derivation
    1. Applied rewrites31.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 \frac{\left({\left(\frac{1 - ux}{maxCos}\right)}^{2} - ux \cdot ux\right) \cdot maxCos}{\color{blue}{\frac{1 - ux}{maxCos} - ux}}} \]
    2. Taylor expanded in ux around 0

      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right)}} \]
    3. 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(\left(2 + -1 \cdot \left(ux \cdot {\left(maxCos - 1\right)}^{2}\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
      2. lower-*.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 83.4% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot maxCos + \left(1 - ux\right)\\ t_1 := \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\ \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot t\_1 \leq 0.0215000007301569:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0} \cdot 1\\ \end{array} \end{array} \]
    (FPCore (ux uy maxCos)
     :precision binary32
     (let* ((t_0 (+ (* ux maxCos) (- 1.0 ux))) (t_1 (cos (* (PI) (* 2.0 uy)))))
       (if (<= (* (sqrt (- 1.0 (* t_0 t_0))) t_1) 0.0215000007301569)
         (* (sqrt (* (fma -2.0 maxCos 2.0) ux)) t_1)
         (* (sqrt (- 1.0 (* (- 1.0 (- ux (* ux maxCos))) t_0))) 1.0))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := ux \cdot maxCos + \left(1 - ux\right)\\
    t_1 := \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\
    \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot t\_1 \leq 0.0215000007301569:\\
    \;\;\;\;\sqrt{\mathsf{fma}\left(-2, maxCos, 2\right) \cdot ux} \cdot t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0} \cdot 1\\
    
    
    \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.0215000007

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

          \[\leadsto \cos \left(\left(uy \cdot 2\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 \cos \left(\left(uy \cdot 2\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. flip--N/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \left(\frac{1}{ux + 1} - \left(\frac{ux \cdot ux}{\color{blue}{ux + 1}} - ux \cdot maxCos\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
        15. lower-+.f3238.0

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

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

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

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

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

        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
      6. Step-by-step derivation
        1. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

      if 0.0215000007 < (*.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 90.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 uy around 0

        \[\leadsto \color{blue}{1} \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. Applied rewrites76.8%

          \[\leadsto \color{blue}{1} \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 1 \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 1 \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 1 \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 1 \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--.f3276.8

            \[\leadsto 1 \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 rewrites76.8%

          \[\leadsto 1 \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. Recombined 2 regimes into one program.
      6. Final simplification67.7%

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

      Alternative 3: 74.5% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot maxCos + \left(1 - ux\right)\\ \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \leq 0.017480000853538513:\\ \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \sqrt{1 - \left(1 - ux\right) \cdot t\_0}\\ \end{array} \end{array} \]
      (FPCore (ux uy maxCos)
       :precision binary32
       (let* ((t_0 (+ (* ux maxCos) (- 1.0 ux))))
         (if (<=
              (* (sqrt (- 1.0 (* t_0 t_0))) (cos (* (PI) (* 2.0 uy))))
              0.017480000853538513)
           (* (sqrt 0.3333333333333333) (sqrt (* (- 6.0 (* 6.0 maxCos)) ux)))
           (* 1.0 (sqrt (- 1.0 (* (- 1.0 ux) t_0)))))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := ux \cdot maxCos + \left(1 - ux\right)\\
      \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \leq 0.017480000853538513:\\
      \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\
      
      \mathbf{else}:\\
      \;\;\;\;1 \cdot \sqrt{1 - \left(1 - ux\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.0174800009

        1. Initial program 36.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}{1} \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. Applied rewrites29.6%

            \[\leadsto \color{blue}{1} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
          2. Applied rewrites29.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\sqrt{\frac{1}{3}} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux} \]
            16. distribute-rgt-outN/A

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

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

              \[\leadsto \left(\sqrt{0.3333333333333333} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux} \]
          5. Applied rewrites91.5%

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

            \[\leadsto \sqrt{\frac{1}{3}} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
          7. Step-by-step derivation
            1. Applied rewrites74.2%

              \[\leadsto \sqrt{0.3333333333333333} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]

            if 0.0174800009 < (*.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.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 uy around 0

              \[\leadsto \color{blue}{1} \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. Applied rewrites76.4%

                \[\leadsto \color{blue}{1} \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 1 \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--.f3271.5

                  \[\leadsto 1 \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
              4. Applied rewrites71.5%

                \[\leadsto 1 \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification73.3%

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

            Alternative 4: 74.5% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot maxCos + \left(1 - ux\right)\\ \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \leq 0.017480000853538513:\\ \;\;\;\;\sqrt{\left(\left(6 - 6 \cdot maxCos\right) \cdot ux\right) \cdot 0.3333333333333333} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \sqrt{1 - \left(1 - ux\right) \cdot t\_0}\\ \end{array} \end{array} \]
            (FPCore (ux uy maxCos)
             :precision binary32
             (let* ((t_0 (+ (* ux maxCos) (- 1.0 ux))))
               (if (<=
                    (* (sqrt (- 1.0 (* t_0 t_0))) (cos (* (PI) (* 2.0 uy))))
                    0.017480000853538513)
                 (* (sqrt (* (* (- 6.0 (* 6.0 maxCos)) ux) 0.3333333333333333)) 1.0)
                 (* 1.0 (sqrt (- 1.0 (* (- 1.0 ux) t_0)))))))
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := ux \cdot maxCos + \left(1 - ux\right)\\
            \mathbf{if}\;\sqrt{1 - t\_0 \cdot t\_0} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \leq 0.017480000853538513:\\
            \;\;\;\;\sqrt{\left(\left(6 - 6 \cdot maxCos\right) \cdot ux\right) \cdot 0.3333333333333333} \cdot 1\\
            
            \mathbf{else}:\\
            \;\;\;\;1 \cdot \sqrt{1 - \left(1 - ux\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.0174800009

              1. Initial program 36.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}{1} \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. Applied rewrites29.6%

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

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

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

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

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

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

                    \[\leadsto 1 \cdot \sqrt{\frac{1}{3} \cdot \left(\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux\right)} \]
                  5. distribute-rgt-outN/A

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

                    \[\leadsto 1 \cdot \sqrt{\frac{1}{3} \cdot \left(\left(6 - maxCos \cdot \color{blue}{6}\right) \cdot ux\right)} \]
                  7. lower-*.f3274.2

                    \[\leadsto 1 \cdot \sqrt{0.3333333333333333 \cdot \left(\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux\right)} \]
                5. Applied rewrites74.2%

                  \[\leadsto 1 \cdot \sqrt{\color{blue}{0.3333333333333333 \cdot \left(\left(6 - maxCos \cdot 6\right) \cdot ux\right)}} \]

                if 0.0174800009 < (*.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.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 uy around 0

                  \[\leadsto \color{blue}{1} \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. Applied rewrites76.4%

                    \[\leadsto \color{blue}{1} \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 1 \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--.f3271.5

                      \[\leadsto 1 \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                  4. Applied rewrites71.5%

                    \[\leadsto 1 \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \color{blue}{\left(1 - ux\right)}} \]
                5. Recombined 2 regimes into one program.
                6. Final simplification73.2%

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

                Alternative 5: 86.7% accurate, 0.9× speedup?

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

                  1. Initial program 89.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 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--.f3283.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)}} \]
                  5. Applied rewrites83.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)}} \]

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

                  1. Initial program 34.3%

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\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 \cos \left(\left(uy \cdot 2\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. flip--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                  6. Step-by-step derivation
                    1. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

                Alternative 6: 95.5% accurate, 1.0× speedup?

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

                  1. Initial program 55.3%

                    \[\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. 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 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                    9. metadata-evalN/A

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 + \color{blue}{-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. *-commutativeN/A

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\color{blue}{maxCos \cdot -2} + 2}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                    14. 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(maxCos, -2, 2\right)}}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                    15. 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(maxCos, -2, 2\right)}{ux} - \color{blue}{{\left(maxCos - 1\right)}^{2}}\right) \cdot {ux}^{2}} \]
                    16. lower--.f32N/A

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

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

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

                    \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(maxCos, -2, 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 rewrites97.6%

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

                    if 2.90000007e-5 < maxCos

                    1. Initial program 55.2%

                      \[\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}{1} \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. Applied rewrites46.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\sqrt{\frac{1}{3}} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux} \]
                        16. distribute-rgt-outN/A

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

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

                          \[\leadsto \left(\sqrt{0.3333333333333333} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux} \]
                      5. Applied rewrites76.2%

                        \[\leadsto \color{blue}{\left(\sqrt{0.3333333333333333} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
                    5. Recombined 2 regimes into one program.
                    6. Final simplification94.2%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;maxCos \leq 2.9000000722589903 \cdot 10^{-5}:\\ \;\;\;\;\sqrt{\left(ux \cdot ux\right) \cdot \left(\frac{2}{ux} - 1\right)} \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux} \cdot \left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{0.3333333333333333}\right)\\ \end{array} \]
                    7. Add Preprocessing

                    Alternative 7: 92.7% accurate, 1.0× speedup?

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

                      \[\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. 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 + \left(\mathsf{neg}\left(2\right)\right) \cdot maxCos}}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                      9. metadata-evalN/A

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{2 + \color{blue}{-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. *-commutativeN/A

                        \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\frac{\color{blue}{maxCos \cdot -2} + 2}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                      14. 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(maxCos, -2, 2\right)}}{ux} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                      15. 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(maxCos, -2, 2\right)}{ux} - \color{blue}{{\left(maxCos - 1\right)}^{2}}\right) \cdot {ux}^{2}} \]
                      16. lower--.f32N/A

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

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

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

                      \[\leadsto \cos \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(maxCos, -2, 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 rewrites90.2%

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

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

                      Alternative 8: 75.7% accurate, 2.5× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot maxCos + \left(1 - ux\right)\\ \mathbf{if}\;t\_0 \leq 0.9998499751091003:\\ \;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\ \end{array} \end{array} \]
                      (FPCore (ux uy maxCos)
                       :precision binary32
                       (let* ((t_0 (+ (* ux maxCos) (- 1.0 ux))))
                         (if (<= t_0 0.9998499751091003)
                           (* (sqrt (- 1.0 (* (- 1.0 (- ux (* ux maxCos))) t_0))) 1.0)
                           (* (sqrt 0.3333333333333333) (sqrt (* (- 6.0 (* 6.0 maxCos)) ux))))))
                      float code(float ux, float uy, float maxCos) {
                      	float t_0 = (ux * maxCos) + (1.0f - ux);
                      	float tmp;
                      	if (t_0 <= 0.9998499751091003f) {
                      		tmp = sqrtf((1.0f - ((1.0f - (ux - (ux * maxCos))) * t_0))) * 1.0f;
                      	} else {
                      		tmp = sqrtf(0.3333333333333333f) * sqrtf(((6.0f - (6.0f * maxCos)) * ux));
                      	}
                      	return tmp;
                      }
                      
                      real(4) function code(ux, uy, maxcos)
                          real(4), intent (in) :: ux
                          real(4), intent (in) :: uy
                          real(4), intent (in) :: maxcos
                          real(4) :: t_0
                          real(4) :: tmp
                          t_0 = (ux * maxcos) + (1.0e0 - ux)
                          if (t_0 <= 0.9998499751091003e0) then
                              tmp = sqrt((1.0e0 - ((1.0e0 - (ux - (ux * maxcos))) * t_0))) * 1.0e0
                          else
                              tmp = sqrt(0.3333333333333333e0) * sqrt(((6.0e0 - (6.0e0 * maxcos)) * ux))
                          end if
                          code = tmp
                      end function
                      
                      function code(ux, uy, maxCos)
                      	t_0 = Float32(Float32(ux * maxCos) + Float32(Float32(1.0) - ux))
                      	tmp = Float32(0.0)
                      	if (t_0 <= Float32(0.9998499751091003))
                      		tmp = Float32(sqrt(Float32(Float32(1.0) - Float32(Float32(Float32(1.0) - Float32(ux - Float32(ux * maxCos))) * t_0))) * Float32(1.0));
                      	else
                      		tmp = Float32(sqrt(Float32(0.3333333333333333)) * sqrt(Float32(Float32(Float32(6.0) - Float32(Float32(6.0) * maxCos)) * ux)));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(ux, uy, maxCos)
                      	t_0 = (ux * maxCos) + (single(1.0) - ux);
                      	tmp = single(0.0);
                      	if (t_0 <= single(0.9998499751091003))
                      		tmp = sqrt((single(1.0) - ((single(1.0) - (ux - (ux * maxCos))) * t_0))) * single(1.0);
                      	else
                      		tmp = sqrt(single(0.3333333333333333)) * sqrt(((single(6.0) - (single(6.0) * maxCos)) * ux));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := ux \cdot maxCos + \left(1 - ux\right)\\
                      \mathbf{if}\;t\_0 \leq 0.9998499751091003:\\
                      \;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot t\_0} \cdot 1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) < 0.999849975

                        1. Initial program 89.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}{1} \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. Applied rewrites71.0%

                            \[\leadsto \color{blue}{1} \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 1 \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 1 \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 1 \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 1 \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--.f3271.1

                              \[\leadsto 1 \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 rewrites71.1%

                            \[\leadsto 1 \cdot \sqrt{1 - \color{blue}{\left(1 - \left(ux - ux \cdot maxCos\right)\right)} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]

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

                          1. Initial program 34.3%

                            \[\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}{1} \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. Applied rewrites30.5%

                              \[\leadsto \color{blue}{1} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                            2. Applied rewrites30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\sqrt{\frac{1}{3}} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux} \]
                              16. distribute-rgt-outN/A

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

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

                                \[\leadsto \left(\sqrt{0.3333333333333333} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux} \]
                            5. Applied rewrites93.5%

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

                              \[\leadsto \sqrt{\frac{1}{3}} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
                            7. Step-by-step derivation
                              1. Applied rewrites77.4%

                                \[\leadsto \sqrt{0.3333333333333333} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
                            8. Recombined 2 regimes into one program.
                            9. Final simplification75.0%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;ux \cdot maxCos + \left(1 - ux\right) \leq 0.9998499751091003:\\ \;\;\;\;\sqrt{1 - \left(1 - \left(ux - ux \cdot maxCos\right)\right) \cdot \left(ux \cdot maxCos + \left(1 - ux\right)\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 9: 75.6% accurate, 2.5× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := ux \cdot maxCos + \left(1 - ux\right)\\ \mathbf{if}\;t\_0 \leq 0.9998499751091003:\\ \;\;\;\;1 \cdot \sqrt{1 - t\_0 \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\ \end{array} \end{array} \]
                            (FPCore (ux uy maxCos)
                             :precision binary32
                             (let* ((t_0 (+ (* ux maxCos) (- 1.0 ux))))
                               (if (<= t_0 0.9998499751091003)
                                 (* 1.0 (sqrt (- 1.0 (* t_0 t_0))))
                                 (* (sqrt 0.3333333333333333) (sqrt (* (- 6.0 (* 6.0 maxCos)) ux))))))
                            float code(float ux, float uy, float maxCos) {
                            	float t_0 = (ux * maxCos) + (1.0f - ux);
                            	float tmp;
                            	if (t_0 <= 0.9998499751091003f) {
                            		tmp = 1.0f * sqrtf((1.0f - (t_0 * t_0)));
                            	} else {
                            		tmp = sqrtf(0.3333333333333333f) * sqrtf(((6.0f - (6.0f * maxCos)) * ux));
                            	}
                            	return tmp;
                            }
                            
                            real(4) function code(ux, uy, maxcos)
                                real(4), intent (in) :: ux
                                real(4), intent (in) :: uy
                                real(4), intent (in) :: maxcos
                                real(4) :: t_0
                                real(4) :: tmp
                                t_0 = (ux * maxcos) + (1.0e0 - ux)
                                if (t_0 <= 0.9998499751091003e0) then
                                    tmp = 1.0e0 * sqrt((1.0e0 - (t_0 * t_0)))
                                else
                                    tmp = sqrt(0.3333333333333333e0) * sqrt(((6.0e0 - (6.0e0 * maxcos)) * ux))
                                end if
                                code = tmp
                            end function
                            
                            function code(ux, uy, maxCos)
                            	t_0 = Float32(Float32(ux * maxCos) + Float32(Float32(1.0) - ux))
                            	tmp = Float32(0.0)
                            	if (t_0 <= Float32(0.9998499751091003))
                            		tmp = Float32(Float32(1.0) * sqrt(Float32(Float32(1.0) - Float32(t_0 * t_0))));
                            	else
                            		tmp = Float32(sqrt(Float32(0.3333333333333333)) * sqrt(Float32(Float32(Float32(6.0) - Float32(Float32(6.0) * maxCos)) * ux)));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(ux, uy, maxCos)
                            	t_0 = (ux * maxCos) + (single(1.0) - ux);
                            	tmp = single(0.0);
                            	if (t_0 <= single(0.9998499751091003))
                            		tmp = single(1.0) * sqrt((single(1.0) - (t_0 * t_0)));
                            	else
                            		tmp = sqrt(single(0.3333333333333333)) * sqrt(((single(6.0) - (single(6.0) * maxCos)) * ux));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := ux \cdot maxCos + \left(1 - ux\right)\\
                            \mathbf{if}\;t\_0 \leq 0.9998499751091003:\\
                            \;\;\;\;1 \cdot \sqrt{1 - t\_0 \cdot t\_0}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (+.f32 (-.f32 #s(literal 1 binary32) ux) (*.f32 ux maxCos)) < 0.999849975

                              1. Initial program 89.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}{1} \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. Applied rewrites71.0%

                                  \[\leadsto \color{blue}{1} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]

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

                                1. Initial program 34.3%

                                  \[\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}{1} \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. Applied rewrites30.5%

                                    \[\leadsto \color{blue}{1} \cdot \sqrt{1 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                                  2. Applied rewrites30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \left(\sqrt{\frac{1}{3}} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux} \]
                                    16. distribute-rgt-outN/A

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

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

                                      \[\leadsto \left(\sqrt{0.3333333333333333} \cdot \cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)\right) \cdot \sqrt{\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux} \]
                                  5. Applied rewrites93.5%

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

                                    \[\leadsto \sqrt{\frac{1}{3}} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites77.4%

                                      \[\leadsto \sqrt{0.3333333333333333} \cdot \sqrt{\color{blue}{\left(6 - maxCos \cdot 6\right) \cdot ux}} \]
                                  8. Recombined 2 regimes into one program.
                                  9. Final simplification75.0%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;ux \cdot maxCos + \left(1 - ux\right) \leq 0.9998499751091003:\\ \;\;\;\;1 \cdot \sqrt{1 - \left(ux \cdot maxCos + \left(1 - ux\right)\right) \cdot \left(ux \cdot maxCos + \left(1 - ux\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.3333333333333333} \cdot \sqrt{\left(6 - 6 \cdot maxCos\right) \cdot ux}\\ \end{array} \]
                                  10. Add Preprocessing

                                  Alternative 10: 64.6% accurate, 4.6× speedup?

                                  \[\begin{array}{l} \\ \sqrt{\left(\left(6 - 6 \cdot maxCos\right) \cdot ux\right) \cdot 0.3333333333333333} \cdot 1 \end{array} \]
                                  (FPCore (ux uy maxCos)
                                   :precision binary32
                                   (* (sqrt (* (* (- 6.0 (* 6.0 maxCos)) ux) 0.3333333333333333)) 1.0))
                                  float code(float ux, float uy, float maxCos) {
                                  	return sqrtf((((6.0f - (6.0f * maxCos)) * ux) * 0.3333333333333333f)) * 1.0f;
                                  }
                                  
                                  real(4) function code(ux, uy, maxcos)
                                      real(4), intent (in) :: ux
                                      real(4), intent (in) :: uy
                                      real(4), intent (in) :: maxcos
                                      code = sqrt((((6.0e0 - (6.0e0 * maxcos)) * ux) * 0.3333333333333333e0)) * 1.0e0
                                  end function
                                  
                                  function code(ux, uy, maxCos)
                                  	return Float32(sqrt(Float32(Float32(Float32(Float32(6.0) - Float32(Float32(6.0) * maxCos)) * ux) * Float32(0.3333333333333333))) * Float32(1.0))
                                  end
                                  
                                  function tmp = code(ux, uy, maxCos)
                                  	tmp = sqrt((((single(6.0) - (single(6.0) * maxCos)) * ux) * single(0.3333333333333333))) * single(1.0);
                                  end
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \sqrt{\left(\left(6 - 6 \cdot maxCos\right) \cdot ux\right) \cdot 0.3333333333333333} \cdot 1
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 55.3%

                                    \[\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}{1} \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. Applied rewrites45.9%

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

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

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

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

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

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

                                        \[\leadsto 1 \cdot \sqrt{\frac{1}{3} \cdot \left(\color{blue}{\left(6 - \left(2 \cdot maxCos + 4 \cdot maxCos\right)\right)} \cdot ux\right)} \]
                                      5. distribute-rgt-outN/A

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

                                        \[\leadsto 1 \cdot \sqrt{\frac{1}{3} \cdot \left(\left(6 - maxCos \cdot \color{blue}{6}\right) \cdot ux\right)} \]
                                      7. lower-*.f3265.6

                                        \[\leadsto 1 \cdot \sqrt{0.3333333333333333 \cdot \left(\left(6 - \color{blue}{maxCos \cdot 6}\right) \cdot ux\right)} \]
                                    5. Applied rewrites65.6%

                                      \[\leadsto 1 \cdot \sqrt{\color{blue}{0.3333333333333333 \cdot \left(\left(6 - maxCos \cdot 6\right) \cdot ux\right)}} \]
                                    6. Final simplification65.6%

                                      \[\leadsto \sqrt{\left(\left(6 - 6 \cdot maxCos\right) \cdot ux\right) \cdot 0.3333333333333333} \cdot 1 \]
                                    7. Add Preprocessing

                                    Alternative 11: 62.1% accurate, 5.8× speedup?

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

                                      \[\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}{1} \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. Applied rewrites45.9%

                                        \[\leadsto \color{blue}{1} \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 1 \cdot \sqrt{\color{blue}{ux \cdot \left(2 - 2 \cdot maxCos\right)}} \]
                                      3. Step-by-step derivation
                                        1. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

                                      Alternative 12: 17.7% accurate, 7.1× speedup?

                                      \[\begin{array}{l} \\ \sqrt{\mathsf{fma}\left(-1, 1, 1\right)} \cdot 1 \end{array} \]
                                      (FPCore (ux uy maxCos) :precision binary32 (* (sqrt (fma -1.0 1.0 1.0)) 1.0))
                                      float code(float ux, float uy, float maxCos) {
                                      	return sqrtf(fmaf(-1.0f, 1.0f, 1.0f)) * 1.0f;
                                      }
                                      
                                      function code(ux, uy, maxCos)
                                      	return Float32(sqrt(fma(Float32(-1.0), Float32(1.0), Float32(1.0))) * Float32(1.0))
                                      end
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \sqrt{\mathsf{fma}\left(-1, 1, 1\right)} \cdot 1
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 55.3%

                                        \[\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}{1} \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. Applied rewrites45.9%

                                          \[\leadsto \color{blue}{1} \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 1 \cdot \sqrt{1 - \color{blue}{1}} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites6.6%

                                            \[\leadsto 1 \cdot \sqrt{1 - \color{blue}{1}} \]
                                          2. Step-by-step derivation
                                            1. lift--.f32N/A

                                              \[\leadsto 1 \cdot \sqrt{\color{blue}{1 - 1}} \]
                                            2. sub-negN/A

                                              \[\leadsto 1 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left(1\right)\right)}} \]
                                            3. +-commutativeN/A

                                              \[\leadsto 1 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + 1}} \]
                                            4. neg-mul-1N/A

                                              \[\leadsto 1 \cdot \sqrt{\color{blue}{-1 \cdot 1} + 1} \]
                                            5. lower-fma.f3219.3

                                              \[\leadsto 1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-1, 1, 1\right)}} \]
                                          3. Applied rewrites19.8%

                                            \[\leadsto 1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(-1, 1, 1\right)}} \]
                                          4. Final simplification19.4%

                                            \[\leadsto \sqrt{\mathsf{fma}\left(-1, 1, 1\right)} \cdot 1 \]
                                          5. Add Preprocessing

                                          Alternative 13: 6.6% accurate, 8.2× speedup?

                                          \[\begin{array}{l} \\ \sqrt{1 - 1} \cdot 1 \end{array} \]
                                          (FPCore (ux uy maxCos) :precision binary32 (* (sqrt (- 1.0 1.0)) 1.0))
                                          float code(float ux, float uy, float maxCos) {
                                          	return sqrtf((1.0f - 1.0f)) * 1.0f;
                                          }
                                          
                                          real(4) function code(ux, uy, maxcos)
                                              real(4), intent (in) :: ux
                                              real(4), intent (in) :: uy
                                              real(4), intent (in) :: maxcos
                                              code = sqrt((1.0e0 - 1.0e0)) * 1.0e0
                                          end function
                                          
                                          function code(ux, uy, maxCos)
                                          	return Float32(sqrt(Float32(Float32(1.0) - Float32(1.0))) * Float32(1.0))
                                          end
                                          
                                          function tmp = code(ux, uy, maxCos)
                                          	tmp = sqrt((single(1.0) - single(1.0))) * single(1.0);
                                          end
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \sqrt{1 - 1} \cdot 1
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 55.3%

                                            \[\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}{1} \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. Applied rewrites45.9%

                                              \[\leadsto \color{blue}{1} \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 1 \cdot \sqrt{1 - \color{blue}{1}} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites6.6%

                                                \[\leadsto 1 \cdot \sqrt{1 - \color{blue}{1}} \]
                                              2. Final simplification6.6%

                                                \[\leadsto \sqrt{1 - 1} \cdot 1 \]
                                              3. Add Preprocessing

                                              Reproduce

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