UniformSampleCone, y

Percentage Accurate: 57.7% → 98.3%
Time: 10.5s
Alternatives: 15
Speedup: 4.5×

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\\ \sin \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))))
   (* (sin (* (* 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\\
\sin \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 15 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.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \sin \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))))
   (* (sin (* (* 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\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - t\_0 \cdot t\_0}
\end{array}
\end{array}

Alternative 1: 98.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(maxCos - 2, -maxCos, -1\right)\\ \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\frac{{\left(\mathsf{fma}\left(-2, maxCos, ux \cdot t\_0\right)\right)}^{2} - 4}{\mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(ux, t\_0, -2\right)\right)} \cdot ux} \end{array} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (let* ((t_0 (fma (- maxCos 2.0) (- maxCos) -1.0)))
   (*
    (sin (* (* uy 2.0) (PI)))
    (sqrt
     (*
      (/
       (- (pow (fma -2.0 maxCos (* ux t_0)) 2.0) 4.0)
       (fma -2.0 maxCos (fma ux t_0 -2.0)))
      ux)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(maxCos - 2, -maxCos, -1\right)\\
\sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\frac{{\left(\mathsf{fma}\left(-2, maxCos, ux \cdot t\_0\right)\right)}^{2} - 4}{\mathsf{fma}\left(-2, maxCos, \mathsf{fma}\left(ux, t\_0, -2\right)\right)} \cdot ux}
\end{array}
\end{array}
Derivation
  1. Initial program 58.2%

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

    \[\leadsto \sin \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)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 2: 98.4% accurate, 1.0× speedup?

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

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

        \[\leadsto \sin \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)}} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{fma}\left(\left(-maxCos\right) \cdot \left(maxCos - 2\right) - 1, ux, -2 \cdot maxCos\right) - -2\right) \cdot ux} \]
        2. Final simplification98.2%

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

        Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

          \[\leadsto \sin \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)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 4: 98.3% accurate, 1.0× speedup?

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

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

              \[\leadsto \sin \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)}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 5: 97.6% accurate, 1.0× speedup?

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

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

                \[\leadsto \sin \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)}} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{fma}\left(2 \cdot maxCos - 1, ux, -2 \cdot maxCos\right) - -2\right) \cdot ux} \]
                3. Step-by-step derivation
                  1. Applied rewrites97.5%

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

                  Alternative 6: 97.6% accurate, 1.1× speedup?

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

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

                    \[\leadsto \sin \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)}} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 7: 96.8% accurate, 1.1× speedup?

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

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

                        \[\leadsto \sin \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)}} \]
                      4. Step-by-step derivation
                        1. *-commutativeN/A

                          \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{fma}\left(-1, ux, -2 \cdot maxCos\right) - -2\right) \cdot ux} \]
                        3. Step-by-step derivation
                          1. Applied rewrites96.9%

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

                          Alternative 8: 95.0% accurate, 1.1× speedup?

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

                            1. Initial program 59.5%

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

                              \[\leadsto \sin \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)}} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if 1.50000007e-4 < maxCos

                              1. Initial program 44.5%

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

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

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

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

                                  \[\leadsto \sin \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 \sin \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 \sin \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.f3283.1

                                  \[\leadsto \sin \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} \]
                              5. Applied rewrites83.1%

                                \[\leadsto \sin \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}} \]
                            8. Recombined 2 regimes into one program.
                            9. Add Preprocessing

                            Alternative 9: 92.4% accurate, 1.2× speedup?

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

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

                              \[\leadsto \sin \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)}} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{ux \cdot \color{blue}{\left(2 - ux\right)}} \]
                            7. Step-by-step derivation
                              1. Applied rewrites92.9%

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

                              Alternative 10: 75.1% accurate, 1.7× speedup?

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

                                1. Initial program 35.3%

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

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

                                    \[\leadsto \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  if 0.0149999997 < (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 88.6%

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

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

                                      \[\leadsto \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                                Alternative 11: 83.9% accurate, 2.1× speedup?

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

                                  \[\sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\color{blue}{\frac{2 - 2 \cdot maxCos}{ux}} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                  8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 12: 81.0% accurate, 2.7× speedup?

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

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

                                      \[\leadsto \sin \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)}} \]
                                    4. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \sin \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 \sin \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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      Alternative 13: 76.8% accurate, 3.1× speedup?

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

                                        \[\sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \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 \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\color{blue}{\frac{2 - 2 \cdot maxCos}{ux}} - {\left(maxCos - 1\right)}^{2}\right) \cdot {ux}^{2}} \]
                                        8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 14: 65.6% accurate, 4.5× speedup?

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

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

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

                                              \[\leadsto \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            Alternative 15: 25.4% accurate, 5.2× speedup?

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

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

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

                                                \[\leadsto \left(2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                Reproduce

                                                ?
                                                herbie shell --seed 2025008 
                                                (FPCore (ux uy maxCos)
                                                  :name "UniformSampleCone, y"
                                                  :precision binary32
                                                  :pre (and (and (and (<= 2.328306437e-10 ux) (<= ux 1.0)) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
                                                  (* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (+ (- 1.0 ux) (* ux maxCos)))))))