UniformSampleCone, y

Percentage Accurate: 57.8% → 98.4%
Time: 10.0s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 57.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 - ux\right) + ux \cdot maxCos\\ \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.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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\right) + 2\right) \cdot ux} \end{array} \]
(FPCore (ux uy maxCos)
 :precision binary32
 (*
  (sin (* (* uy 2.0) (PI)))
  (sqrt
   (* (+ (fma (- (fma (- maxCos) ux (* 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(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\right) + 2\right) \cdot ux}
\end{array}
Derivation
  1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\frac{\mathsf{fma}\left(maxCos, ux, 1\right) \cdot \mathsf{fma}\left(maxCos, ux, 1\right) - ux \cdot ux}{\mathsf{fma}\left(maxCos, ux, 1\right) + ux}} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
  5. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right)}} \]
  6. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
  7. Applied rewrites98.6%

    \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(2 \cdot maxCos - 2, maxCos + 1, 1\right) - \mathsf{fma}\left(\left(maxCos - 1\right) \cdot maxCos, 2, maxCos \cdot maxCos\right), ux, 2\right) - 2 \cdot maxCos\right) \cdot ux}} \]
  8. 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(\left(-1 \cdot \left(maxCos \cdot ux\right) + 2 \cdot ux\right) - 2\right)\right)\right) \cdot ux} \]
  9. Step-by-step derivation
    1. Applied rewrites98.6%

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

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

    Alternative 2: 98.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\frac{\mathsf{fma}\left(maxCos, ux, 1\right) \cdot \mathsf{fma}\left(maxCos, ux, 1\right) - ux \cdot ux}{\mathsf{fma}\left(maxCos, ux, 1\right) + ux}} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
    5. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right)}} \]
    6. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
    7. Applied rewrites98.6%

      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(2 \cdot maxCos - 2, maxCos + 1, 1\right) - \mathsf{fma}\left(\left(maxCos - 1\right) \cdot maxCos, 2, maxCos \cdot maxCos\right), ux, 2\right) - 2 \cdot maxCos\right) \cdot ux}} \]
    8. 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(\left(-1 \cdot \left(maxCos \cdot ux\right) + 2 \cdot ux\right) - 2\right)\right)\right) \cdot ux} \]
    9. Step-by-step derivation
      1. Applied rewrites98.6%

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

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

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

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

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

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

      Alternative 3: 97.6% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\frac{\mathsf{fma}\left(maxCos, ux, 1\right) \cdot \mathsf{fma}\left(maxCos, ux, 1\right) - ux \cdot ux}{\mathsf{fma}\left(maxCos, ux, 1\right) + ux}} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
      5. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right)}} \]
      6. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
      7. Applied rewrites98.6%

        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(2 \cdot maxCos - 2, maxCos + 1, 1\right) - \mathsf{fma}\left(\left(maxCos - 1\right) \cdot maxCos, 2, maxCos \cdot maxCos\right), ux, 2\right) - 2 \cdot maxCos\right) \cdot ux}} \]
      8. 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} \]
      9. Step-by-step derivation
        1. Applied rewrites98.4%

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

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

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

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

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

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

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

        Alternative 4: 96.9% accurate, 1.1× speedup?

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

          \[\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.6

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

          \[\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. Step-by-step derivation
          1. Applied rewrites98.5%

            \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{fma}\left(-1 \cdot \mathsf{fma}\left(ux \cdot ux, maxCos, \mathsf{fma}\left(-2, ux, 2\right) \cdot ux\right), \color{blue}{maxCos}, \left(2 - ux\right) \cdot ux\right)} \]
          2. 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 \cdot ux, maxCos, \left(2 - ux\right) \cdot ux\right)} \]
          3. Step-by-step derivation
            1. Applied rewrites97.8%

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

            Alternative 5: 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 59.9%

              \[\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.6

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

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

                \[\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 6: 82.3% 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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\right) + 2\right) \cdot ux} \end{array} \]
              (FPCore (ux uy maxCos)
               :precision binary32
               (*
                (* (* (PI) uy) 2.0)
                (sqrt
                 (* (+ (fma (- (fma (- maxCos) ux (* 2.0 ux)) 2.0) maxCos (- ux)) 2.0) ux))))
              \begin{array}{l}
              
              \\
              \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot \sqrt{\left(\mathsf{fma}\left(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\right) + 2\right) \cdot ux}
              \end{array}
              
              Derivation
              1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\frac{\mathsf{fma}\left(maxCos, ux, 1\right) \cdot \mathsf{fma}\left(maxCos, ux, 1\right) - ux \cdot ux}{\mathsf{fma}\left(maxCos, ux, 1\right) + ux}} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
              5. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right)}} \]
              6. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
              7. Applied rewrites98.6%

                \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(2 \cdot maxCos - 2, maxCos + 1, 1\right) - \mathsf{fma}\left(\left(maxCos - 1\right) \cdot maxCos, 2, maxCos \cdot maxCos\right), ux, 2\right) - 2 \cdot maxCos\right) \cdot ux}} \]
              8. 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(\left(-1 \cdot \left(maxCos \cdot ux\right) + 2 \cdot ux\right) - 2\right)\right)\right) \cdot ux} \]
              9. Step-by-step derivation
                1. Applied rewrites98.6%

                  \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{fma}\left(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\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(\mathsf{fma}\left(-maxCos, ux, 2 \cdot ux\right) - 2, maxCos, -ux\right) + 2\right) \cdot ux} \]
                  5. lower-PI.f3282.5

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

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

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

                Alternative 7: 82.2% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\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 \left(\left(1 - ux\right) + \color{blue}{ux \cdot maxCos}\right)} \]
                  14. distribute-rgt-inN/A

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

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

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

                  \[\leadsto \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot uy\right) \cdot \sqrt{\color{blue}{\left(1 - \mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot \left(1 - ux\right)\right) - \left(\mathsf{fma}\left(maxCos, ux, 1 - ux\right) \cdot maxCos\right) \cdot ux}} \]
                8. 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(\left(2 + -1 \cdot \left(ux \cdot \left(-1 \cdot \left(maxCos - 1\right) + maxCos \cdot \left(maxCos - 1\right)\right)\right)\right) - 2 \cdot maxCos\right)}} \]
                9. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

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

                Alternative 8: 77.3% accurate, 2.8× speedup?

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

                  1. Initial program 38.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.f3236.2

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

                    \[\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.f3278.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 rewrites78.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 rewrites78.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} \]

                    if 1.10000001e-4 < ux

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

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

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}} \]
                      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}{1 + \left(\mathsf{neg}\left(\left(\left(1 - ux\right) + ux \cdot maxCos\right)\right)\right) \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)}} \]
                      4. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 9: 76.1% accurate, 2.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ux \leq 0.00011000000085914508:\\ \;\;\;\;\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 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\ \end{array} \end{array} \]
                  (FPCore (ux uy maxCos)
                   :precision binary32
                   (if (<= ux 0.00011000000085914508)
                     (* (* (+ (PI) (PI)) uy) (sqrt (* (fma -2.0 maxCos 2.0) ux)))
                     (*
                      (* (* (PI) 2.0) uy)
                      (sqrt (- 1.0 (* (+ (- 1.0 ux) (* ux maxCos)) (- 1.0 ux)))))))
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;ux \leq 0.00011000000085914508:\\
                  \;\;\;\;\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 - \left(\left(1 - ux\right) + ux \cdot maxCos\right) \cdot \left(1 - ux\right)}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if ux < 1.10000001e-4

                    1. Initial program 38.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.f3236.2

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

                      \[\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.f3278.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 rewrites78.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 rewrites78.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} \]

                      if 1.10000001e-4 < ux

                      1. Initial program 90.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.f3277.9

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

                        \[\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--.f3276.5

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

                        \[\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 10: 81.7% accurate, 3.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{1 - \color{blue}{\frac{\mathsf{fma}\left(maxCos, ux, 1\right) \cdot \mathsf{fma}\left(maxCos, ux, 1\right) - ux \cdot ux}{\mathsf{fma}\left(maxCos, ux, 1\right) + ux}} \cdot \left(\left(1 - ux\right) + ux \cdot maxCos\right)} \]
                    5. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right)}} \]
                    6. 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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\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 + ux \cdot \left(\left(1 + \left(1 + maxCos\right) \cdot \left(2 \cdot maxCos - 2\right)\right) - \left(2 \cdot \left(maxCos \cdot \left(maxCos - 1\right)\right) + {maxCos}^{2}\right)\right)\right) - 2 \cdot maxCos\right) \cdot ux}} \]
                    7. Applied rewrites98.6%

                      \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(2 \cdot maxCos - 2, maxCos + 1, 1\right) - \mathsf{fma}\left(\left(maxCos - 1\right) \cdot maxCos, 2, maxCos \cdot maxCos\right), ux, 2\right) - 2 \cdot maxCos\right) \cdot ux}} \]
                    8. 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} \]
                    9. Step-by-step derivation
                      1. Applied rewrites98.4%

                        \[\leadsto \sin \left(\left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\left(\mathsf{fma}\left(2 \cdot ux - 2, maxCos, -ux\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(2 \cdot ux - 2, maxCos, -ux\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(2 \cdot ux - 2, maxCos, -ux\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(2 \cdot ux - 2, maxCos, -ux\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(2 \cdot ux - 2, maxCos, -ux\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(2 \cdot ux - 2, maxCos, -ux\right) + 2\right) \cdot ux} \]
                        5. lower-PI.f3282.4

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

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

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

                      Alternative 11: 66.5% 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 59.9%

                        \[\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.f3253.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 rewrites53.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.f3265.3

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

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

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

                        Reproduce

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