UniformSampleCone 2

Percentage Accurate: 99.0% → 98.8%
Time: 17.0s
Alternatives: 24
Speedup: N/A×

Specification

?
\[\left(\left(\left(\left(\left(-10000 \leq xi \land xi \leq 10000\right) \land \left(-10000 \leq yi \land yi \leq 10000\right)\right) \land \left(-10000 \leq zi \land zi \leq 10000\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq ux \land ux \leq 1\right)\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(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\ t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\ t_2 := \left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\\ \left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (* (- 1.0 ux) maxCos) ux))
        (t_1 (sqrt (- 1.0 (* t_0 t_0))))
        (t_2 (* (* uy 2.0) (PI))))
   (+ (+ (* (* (cos t_2) t_1) xi) (* (* (sin t_2) t_1) yi)) (* t_0 zi))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi
\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 24 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: 99.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \sqrt{1 - t\_0 \cdot t\_0}\\
t_2 := \left(uy \cdot 2\right) \cdot \mathsf{PI}\left(\right)\\
\left(\left(\cos t\_2 \cdot t\_1\right) \cdot xi + \left(\sin t\_2 \cdot t\_1\right) \cdot yi\right) + t\_0 \cdot zi
\end{array}
\end{array}

Alternative 1: 98.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot -2, uy, \frac{\mathsf{PI}\left(\right)}{2}\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (fma
  (sin (fma (* (PI) -2.0) uy (/ (PI) 2.0)))
  xi
  (fma (sin (* (* (PI) uy) 2.0)) yi (* (* (* (- 1.0 ux) zi) ux) maxCos))))
\begin{array}{l}

\\
\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot -2, uy, \frac{\mathsf{PI}\left(\right)}{2}\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)
\end{array}
Derivation
  1. Initial program 98.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
    5. cos-neg-revN/A

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
    8. metadata-evalN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
    12. lower-PI.f32N/A

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

      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
  5. Applied rewrites98.8%

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

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

    Alternative 2: 98.8% accurate, 1.4× speedup?

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
      5. cos-neg-revN/A

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
      8. metadata-evalN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
      12. lower-PI.f32N/A

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

        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
    5. Applied rewrites98.8%

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

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

      Alternative 3: 98.8% accurate, 1.4× speedup?

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
        5. cos-neg-revN/A

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        7. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        8. metadata-evalN/A

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        12. lower-PI.f32N/A

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. Applied rewrites98.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)} \]
      6. Applied rewrites98.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right), yi, \mathsf{fma}\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot -2\right), xi, \left(\left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\right) \cdot zi\right)\right)} \]
      7. Add Preprocessing

      Alternative 4: 98.8% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot uy\\ \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(\sin \left(t\_0 \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \end{array} \end{array} \]
      (FPCore (xi yi zi ux uy maxCos)
       :precision binary32
       (let* ((t_0 (* (PI) uy)))
         (fma
          (cos (* -2.0 t_0))
          xi
          (fma (sin (* t_0 2.0)) yi (* (* (* (- 1.0 ux) zi) ux) maxCos)))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{PI}\left(\right) \cdot uy\\
      \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(\sin \left(t\_0 \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)
      \end{array}
      \end{array}
      
      Derivation
      1. Initial program 98.7%

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
        5. cos-neg-revN/A

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        7. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        8. metadata-evalN/A

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
        12. lower-PI.f32N/A

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
      5. Applied rewrites98.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)} \]
      6. Add Preprocessing

      Alternative 5: 95.7% accurate, 1.5× speedup?

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

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

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

          \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
        2. associate-+l+N/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
        5. cos-neg-revN/A

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
        7. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
        8. metadata-evalN/A

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
        11. lower-*.f32N/A

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
        12. lower-PI.f32N/A

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
      5. Applied rewrites96.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right)} \]
      6. Step-by-step derivation
        1. Applied rewrites96.2%

          \[\leadsto \mathsf{fma}\left(\sin \left(\left(2 \cdot uy\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{yi}, \mathsf{fma}\left(maxCos \cdot zi, ux, \cos \left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot -2\right) \cdot xi\right)\right) \]
        2. Add Preprocessing

        Alternative 6: 95.7% accurate, 1.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot uy\\ \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(\sin \left(t\_0 \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right) \end{array} \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (let* ((t_0 (* (PI) uy)))
           (fma
            (cos (* -2.0 t_0))
            xi
            (fma (sin (* t_0 2.0)) yi (* (* zi ux) maxCos)))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{PI}\left(\right) \cdot uy\\
        \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(\sin \left(t\_0 \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 98.7%

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

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

            \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
          2. associate-+l+N/A

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
          5. cos-neg-revN/A

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
          7. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
          8. metadata-evalN/A

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

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

            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
          11. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
          12. lower-PI.f32N/A

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

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

            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
        5. Applied rewrites96.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right)} \]
        6. Add Preprocessing

        Alternative 7: 97.3% accurate, 1.5× speedup?

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

          1. Initial program 99.2%

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
            5. cos-neg-revN/A

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            7. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            8. metadata-evalN/A

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

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

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

              \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            12. lower-PI.f32N/A

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

              \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
          5. Applied rewrites99.3%

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

            \[\leadsto \mathsf{fma}\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]
          7. Step-by-step derivation
            1. Applied rewrites99.3%

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]

            if 0.0109999999 < uy

            1. Initial program 96.7%

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
              5. cos-neg-revN/A

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
              7. distribute-lft-neg-inN/A

                \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
              8. metadata-evalN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
              12. lower-PI.f32N/A

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

                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            5. Applied rewrites96.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites97.6%

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

                \[\leadsto xi \cdot \sin \left(-2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
              3. Step-by-step derivation
                1. Applied rewrites90.6%

                  \[\leadsto \mathsf{fma}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(-2, uy, 0.5\right)\right), \color{blue}{xi}, \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right) \]
              4. Recombined 2 regimes into one program.
              5. Final simplification97.5%

                \[\leadsto \begin{array}{l} \mathbf{if}\;uy \leq 0.010999999940395355:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(-2, uy, 0.5\right)\right), xi, \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right)\\ \end{array} \]
              6. Add Preprocessing

              Alternative 8: 97.2% accurate, 1.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot uy\\ t_1 := \sin \left(t\_0 \cdot 2\right)\\ \mathbf{if}\;uy \leq 0.010999999940395355:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right), xi, \mathsf{fma}\left(t\_1, yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, t\_1 \cdot yi\right)\\ \end{array} \end{array} \]
              (FPCore (xi yi zi ux uy maxCos)
               :precision binary32
               (let* ((t_0 (* (PI) uy)) (t_1 (sin (* t_0 2.0))))
                 (if (<= uy 0.010999999940395355)
                   (fma
                    (fma (* -2.0 (* uy uy)) (* (PI) (PI)) 1.0)
                    xi
                    (fma t_1 yi (* (* (* (- 1.0 ux) zi) ux) maxCos)))
                   (fma (cos (* -2.0 t_0)) xi (* t_1 yi)))))
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \mathsf{PI}\left(\right) \cdot uy\\
              t_1 := \sin \left(t\_0 \cdot 2\right)\\
              \mathbf{if}\;uy \leq 0.010999999940395355:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right), xi, \mathsf{fma}\left(t\_1, yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, t\_1 \cdot yi\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if uy < 0.0109999999

                1. Initial program 99.2%

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                  5. cos-neg-revN/A

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  7. distribute-lft-neg-inN/A

                    \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  8. metadata-evalN/A

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

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

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

                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  12. lower-PI.f32N/A

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

                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                5. Applied rewrites99.3%

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

                  \[\leadsto \mathsf{fma}\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites99.3%

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-2 \cdot \left(uy \cdot uy\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]

                  if 0.0109999999 < uy

                  1. Initial program 96.7%

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                    5. cos-neg-revN/A

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

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                    7. distribute-lft-neg-inN/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                    8. metadata-evalN/A

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

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                    12. lower-PI.f32N/A

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  5. Applied rewrites96.9%

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

                    \[\leadsto \color{blue}{xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                  7. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \color{blue}{\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot xi} + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \]
                    2. lower-fma.f32N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                    3. cos-neg-revN/A

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    4. lower-cos.f32N/A

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    5. distribute-lft-neg-inN/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    6. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\color{blue}{-2} \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    7. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(-2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    9. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    10. lower-PI.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot uy\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
                    11. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi}\right) \]
                    12. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi}\right) \]
                    13. lower-sin.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot yi\right) \]
                    14. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \color{blue}{\left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right)} \cdot yi\right) \]
                    15. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \color{blue}{\left(\left(uy \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right)} \cdot yi\right) \]
                    16. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)} \cdot 2\right) \cdot yi\right) \]
                    17. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)} \cdot 2\right) \cdot yi\right) \]
                    18. lower-PI.f3290.0

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot uy\right) \cdot 2\right) \cdot yi\right) \]
                  8. Applied rewrites90.0%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right) \cdot yi\right)} \]
                8. Recombined 2 regimes into one program.
                9. Add Preprocessing

                Alternative 9: 93.0% accurate, 2.2× speedup?

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                  5. cos-neg-revN/A

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  7. distribute-lft-neg-inN/A

                    \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  8. metadata-evalN/A

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

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

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

                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                  12. lower-PI.f32N/A

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

                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                5. Applied rewrites98.8%

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

                  \[\leadsto \mathsf{fma}\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites93.9%

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

                  Alternative 10: 90.0% accurate, 2.3× speedup?

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

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

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

                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                    2. associate-+l+N/A

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                    5. cos-neg-revN/A

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

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                    7. distribute-lft-neg-inN/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                    8. metadata-evalN/A

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                    11. lower-*.f32N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                    12. lower-PI.f32N/A

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                  5. Applied rewrites96.1%

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

                    \[\leadsto \mathsf{fma}\left(1 + -2 \cdot \left({uy}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites91.3%

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

                    Alternative 11: 88.3% accurate, 2.3× speedup?

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                      5. cos-neg-revN/A

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

                        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                      7. distribute-lft-neg-inN/A

                        \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                      8. metadata-evalN/A

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                      12. lower-PI.f32N/A

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                    5. Applied rewrites98.8%

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, zi \cdot \left(maxCos \cdot \left(ux \cdot \left(1 - ux\right)\right) + \frac{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}{zi}\right)\right) \]
                    7. Step-by-step derivation
                      1. Applied rewrites98.7%

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

                        \[\leadsto \mathsf{fma}\left(1, xi, \mathsf{fma}\left(yi, \frac{\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right)}{zi}, \left(\left(1 - ux\right) \cdot ux\right) \cdot maxCos\right) \cdot zi\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites89.4%

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

                        Alternative 12: 90.1% accurate, 2.3× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot uy\\ \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(t\_0 \cdot 2, yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \end{array} \end{array} \]
                        (FPCore (xi yi zi ux uy maxCos)
                         :precision binary32
                         (let* ((t_0 (* (PI) uy)))
                           (fma
                            (cos (* -2.0 t_0))
                            xi
                            (fma (* t_0 2.0) yi (* (* (* (- 1.0 ux) zi) ux) maxCos)))))
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        t_0 := \mathsf{PI}\left(\right) \cdot uy\\
                        \mathsf{fma}\left(\cos \left(-2 \cdot t\_0\right), xi, \mathsf{fma}\left(t\_0 \cdot 2, yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right)
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Initial program 98.7%

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

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

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

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

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

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                          5. cos-neg-revN/A

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

                            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                          7. distribute-lft-neg-inN/A

                            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                          8. metadata-evalN/A

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

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

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

                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                          12. lower-PI.f32N/A

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

                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                        5. Applied rewrites98.8%

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

                          \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \mathsf{fma}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right), yi, \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos\right)\right) \]
                        7. Step-by-step derivation
                          1. Applied rewrites88.7%

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

                          Alternative 13: 90.1% accurate, 2.3× speedup?

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                            5. cos-neg-revN/A

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

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                            7. distribute-lft-neg-inN/A

                              \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                            8. metadata-evalN/A

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

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

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

                              \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                            12. lower-PI.f32N/A

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

                              \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                          5. Applied rewrites98.8%

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

                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                          7. Step-by-step derivation
                            1. Applied rewrites88.7%

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

                            Alternative 14: 88.7% accurate, 2.5× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.0042500002309679985:\\ \;\;\;\;\mathsf{fma}\left(\left(1 - ux\right) \cdot ux, zi \cdot maxCos, \mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right)\\ \end{array} \end{array} \]
                            (FPCore (xi yi zi ux uy maxCos)
                             :precision binary32
                             (if (<= uy 0.0042500002309679985)
                               (fma
                                (* (- 1.0 ux) ux)
                                (* zi maxCos)
                                (fma (fma (* (* (* (PI) (PI)) xi) uy) -2.0 (* (* yi (PI)) 2.0)) uy xi))
                               (fma 1.0 xi (fma (sin (* (* (PI) uy) 2.0)) yi (* (* zi ux) maxCos)))))
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;uy \leq 0.0042500002309679985:\\
                            \;\;\;\;\mathsf{fma}\left(\left(1 - ux\right) \cdot ux, zi \cdot maxCos, \mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right)\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\mathsf{fma}\left(1, xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right)\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if uy < 0.00425000023

                              1. Initial program 99.2%

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

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

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

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

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

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                5. cos-neg-revN/A

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

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                7. distribute-lft-neg-inN/A

                                  \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                8. metadata-evalN/A

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                12. lower-PI.f32N/A

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

                                  \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                              5. Applied rewrites99.3%

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

                                \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                              7. Step-by-step derivation
                                1. Applied rewrites97.8%

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

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

                                  if 0.00425000023 < uy

                                  1. Initial program 97.0%

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

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

                                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                    2. associate-+l+N/A

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

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

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                    5. cos-neg-revN/A

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

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                    7. distribute-lft-neg-inN/A

                                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                    8. metadata-evalN/A

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

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

                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                    11. lower-*.f32N/A

                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                    12. lower-PI.f32N/A

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

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

                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                  5. Applied rewrites95.8%

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

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

                                      \[\leadsto \mathsf{fma}\left(1, xi, \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\right) \]
                                  8. Recombined 2 regimes into one program.
                                  9. Add Preprocessing

                                  Alternative 15: 88.1% accurate, 2.7× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;uy \leq 0.05999999865889549:\\ \;\;\;\;\mathsf{fma}\left(\left(1 - ux\right) \cdot ux, zi \cdot maxCos, \mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\\ \end{array} \end{array} \]
                                  (FPCore (xi yi zi ux uy maxCos)
                                   :precision binary32
                                   (if (<= uy 0.05999999865889549)
                                     (fma
                                      (* (- 1.0 ux) ux)
                                      (* zi maxCos)
                                      (fma (fma (* (* (* (PI) (PI)) xi) uy) -2.0 (* (* yi (PI)) 2.0)) uy xi))
                                     (fma (sin (* (* (PI) uy) 2.0)) yi (* (* zi ux) maxCos))))
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;uy \leq 0.05999999865889549:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(1 - ux\right) \cdot ux, zi \cdot maxCos, \mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, xi\right)\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), yi, \left(zi \cdot ux\right) \cdot maxCos\right)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if uy < 0.0599999987

                                    1. Initial program 99.0%

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

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

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

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

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

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                      5. cos-neg-revN/A

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

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                      7. distribute-lft-neg-inN/A

                                        \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                      8. metadata-evalN/A

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

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

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

                                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                      12. lower-PI.f32N/A

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

                                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                    5. Applied rewrites99.2%

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

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

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

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

                                        if 0.0599999987 < uy

                                        1. Initial program 95.7%

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

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

                                            \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                          2. associate-+l+N/A

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

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

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                          5. cos-neg-revN/A

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

                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                          7. distribute-lft-neg-inN/A

                                            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                          8. metadata-evalN/A

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

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

                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                          11. lower-*.f32N/A

                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                          12. lower-PI.f32N/A

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

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

                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                        5. Applied rewrites93.7%

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

                                          \[\leadsto maxCos \cdot \left(ux \cdot zi\right) + \color{blue}{yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites61.0%

                                            \[\leadsto \mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot uy\right) \cdot 2\right), \color{blue}{yi}, \left(zi \cdot ux\right) \cdot maxCos\right) \]
                                        8. Recombined 2 regimes into one program.
                                        9. Add Preprocessing

                                        Alternative 16: 85.8% accurate, 6.2× speedup?

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

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

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

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

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

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

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                          5. cos-neg-revN/A

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

                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                          7. distribute-lft-neg-inN/A

                                            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                          8. metadata-evalN/A

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                          12. lower-PI.f32N/A

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

                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                        5. Applied rewrites98.8%

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

                                          \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites85.3%

                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot xi\right) \cdot uy, -2, \left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right), uy, \left(\left(zi \cdot \left(1 - ux\right)\right) \cdot ux\right) \cdot maxCos\right) + \color{blue}{xi} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites85.4%

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

                                            Alternative 17: 85.8% accurate, 6.5× speedup?

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

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

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

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

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

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

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                              5. cos-neg-revN/A

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

                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                              7. distribute-lft-neg-inN/A

                                                \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                              8. metadata-evalN/A

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

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

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

                                                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                              12. lower-PI.f32N/A

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

                                                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                            5. Applied rewrites98.8%

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

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

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

                                                \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites85.4%

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

                                                Alternative 18: 82.9% accurate, 7.7× speedup?

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

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

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

                                                    \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                                  2. associate-+l+N/A

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

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

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                                  5. cos-neg-revN/A

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

                                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                  7. distribute-lft-neg-inN/A

                                                    \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                  8. metadata-evalN/A

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

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

                                                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                  11. lower-*.f32N/A

                                                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                  12. lower-PI.f32N/A

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

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

                                                    \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                                5. Applied rewrites96.1%

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

                                                  \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot zi\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites82.9%

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

                                                  Alternative 19: 81.7% accurate, 9.8× speedup?

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

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

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

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

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

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

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                                    5. cos-neg-revN/A

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

                                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                    7. distribute-lft-neg-inN/A

                                                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                    8. metadata-evalN/A

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

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

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

                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                    12. lower-PI.f32N/A

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

                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                  5. Applied rewrites98.8%

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

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

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

                                                      \[\leadsto xi + \color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites81.8%

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

                                                      Alternative 20: 60.8% accurate, 11.0× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\right)\\ \end{array} \end{array} \]
                                                      (FPCore (xi yi zi ux uy maxCos)
                                                       :precision binary32
                                                       (if (or (<= yi -2.7819999637301862e-9) (not (<= yi 1.1999999620013451e-14)))
                                                         (* (* (* yi (PI)) uy) 2.0)
                                                         (fma (* maxCos ux) (* zi (- 1.0 ux)) xi)))
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\
                                                      \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\right)\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if yi < -2.78199996e-9 or 1.19999996e-14 < yi

                                                        1. Initial program 98.5%

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

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

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

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

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

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                                          5. cos-neg-revN/A

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

                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                          7. distribute-lft-neg-inN/A

                                                            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                          8. metadata-evalN/A

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

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

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

                                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                          12. lower-PI.f32N/A

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

                                                            \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                        5. Applied rewrites98.6%

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

                                                          \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                                                        7. Step-by-step derivation
                                                          1. Applied rewrites80.2%

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

                                                            \[\leadsto 2 \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites59.2%

                                                              \[\leadsto \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 \]

                                                            if -2.78199996e-9 < yi < 1.19999996e-14

                                                            1. Initial program 98.8%

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

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

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

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

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

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                                              5. cos-neg-revN/A

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

                                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                              7. distribute-lft-neg-inN/A

                                                                \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                              8. metadata-evalN/A

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

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

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

                                                                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                              12. lower-PI.f32N/A

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

                                                                \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                            5. Applied rewrites99.0%

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

                                                              \[\leadsto xi + \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites67.0%

                                                                \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, xi\right) \]
                                                            8. Recombined 2 regimes into one program.
                                                            9. Final simplification64.1%

                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi \cdot \left(1 - ux\right), xi\right)\\ \end{array} \]
                                                            10. Add Preprocessing

                                                            Alternative 21: 58.9% accurate, 12.6× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi, xi\right)\\ \end{array} \end{array} \]
                                                            (FPCore (xi yi zi ux uy maxCos)
                                                             :precision binary32
                                                             (if (or (<= yi -2.7819999637301862e-9) (not (<= yi 1.1999999620013451e-14)))
                                                               (* (* (* yi (PI)) uy) 2.0)
                                                               (fma (* maxCos ux) zi xi)))
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\
                                                            \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi, xi\right)\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if yi < -2.78199996e-9 or 1.19999996e-14 < yi

                                                              1. Initial program 98.5%

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

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

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

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

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

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
                                                                5. cos-neg-revN/A

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

                                                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                                7. distribute-lft-neg-inN/A

                                                                  \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                                8. metadata-evalN/A

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                                12. lower-PI.f32N/A

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

                                                                  \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi} + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
                                                              5. Applied rewrites98.6%

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

                                                                \[\leadsto xi + \color{blue}{\left(maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) + uy \cdot \left(-2 \cdot \left(uy \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites80.2%

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

                                                                  \[\leadsto 2 \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites59.2%

                                                                    \[\leadsto \left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2 \]

                                                                  if -2.78199996e-9 < yi < 1.19999996e-14

                                                                  1. Initial program 98.8%

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

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

                                                                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                                                    2. associate-+l+N/A

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

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

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                                                    5. cos-neg-revN/A

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

                                                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    7. distribute-lft-neg-inN/A

                                                                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    8. metadata-evalN/A

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

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

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    11. lower-*.f32N/A

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    12. lower-PI.f32N/A

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

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

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                                                  5. Applied rewrites95.0%

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

                                                                    \[\leadsto xi + \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites64.3%

                                                                      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi}, xi\right) \]
                                                                  8. Recombined 2 regimes into one program.
                                                                  9. Final simplification62.4%

                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;yi \leq -2.7819999637301862 \cdot 10^{-9} \lor \neg \left(yi \leq 1.1999999620013451 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\left(yi \cdot \mathsf{PI}\left(\right)\right) \cdot uy\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, zi, xi\right)\\ \end{array} \]
                                                                  10. Add Preprocessing

                                                                  Alternative 22: 78.9% accurate, 12.6× speedup?

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

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

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

                                                                      \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                                                    2. associate-+l+N/A

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

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

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                                                    5. cos-neg-revN/A

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

                                                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    7. distribute-lft-neg-inN/A

                                                                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    8. metadata-evalN/A

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

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

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    11. lower-*.f32N/A

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                    12. lower-PI.f32N/A

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

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

                                                                      \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                                                  5. Applied rewrites96.1%

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

                                                                    \[\leadsto xi + \color{blue}{\left(2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites79.3%

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

                                                                    Alternative 23: 50.1% accurate, 29.4× speedup?

                                                                    \[\begin{array}{l} \\ \mathsf{fma}\left(maxCos \cdot ux, zi, xi\right) \end{array} \]
                                                                    (FPCore (xi yi zi ux uy maxCos) :precision binary32 (fma (* maxCos ux) zi xi))
                                                                    float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                                                    	return fmaf((maxCos * ux), zi, xi);
                                                                    }
                                                                    
                                                                    function code(xi, yi, zi, ux, uy, maxCos)
                                                                    	return fma(Float32(maxCos * ux), zi, xi)
                                                                    end
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \mathsf{fma}\left(maxCos \cdot ux, zi, xi\right)
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 98.7%

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

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

                                                                        \[\leadsto \color{blue}{\left(xi \cdot \cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)} \]
                                                                      2. associate-+l+N/A

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

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

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right)} \]
                                                                      5. cos-neg-revN/A

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

                                                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\mathsf{neg}\left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                      7. distribute-lft-neg-inN/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\left(\mathsf{neg}\left(2\right)\right) \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right)}, xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                      8. metadata-evalN/A

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

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

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                      11. lower-*.f32N/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot uy\right)}\right), xi, yi \cdot \sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) + maxCos \cdot \left(ux \cdot zi\right)\right) \]
                                                                      12. lower-PI.f32N/A

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

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

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(-2 \cdot \left(\mathsf{PI}\left(\right) \cdot uy\right)\right), xi, \color{blue}{\mathsf{fma}\left(\sin \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right), yi, maxCos \cdot \left(ux \cdot zi\right)\right)}\right) \]
                                                                    5. Applied rewrites96.1%

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

                                                                      \[\leadsto xi + \color{blue}{maxCos \cdot \left(ux \cdot zi\right)} \]
                                                                    7. Step-by-step derivation
                                                                      1. Applied rewrites47.9%

                                                                        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi}, xi\right) \]
                                                                      2. Add Preprocessing

                                                                      Alternative 24: 12.4% accurate, 32.1× speedup?

                                                                      \[\begin{array}{l} \\ \left(zi \cdot ux\right) \cdot maxCos \end{array} \]
                                                                      (FPCore (xi yi zi ux uy maxCos) :precision binary32 (* (* zi ux) maxCos))
                                                                      float code(float xi, float yi, float zi, float ux, float uy, float maxCos) {
                                                                      	return (zi * ux) * maxCos;
                                                                      }
                                                                      
                                                                      module fmin_fmax_functions
                                                                          implicit none
                                                                          private
                                                                          public fmax
                                                                          public fmin
                                                                      
                                                                          interface fmax
                                                                              module procedure fmax88
                                                                              module procedure fmax44
                                                                              module procedure fmax84
                                                                              module procedure fmax48
                                                                          end interface
                                                                          interface fmin
                                                                              module procedure fmin88
                                                                              module procedure fmin44
                                                                              module procedure fmin84
                                                                              module procedure fmin48
                                                                          end interface
                                                                      contains
                                                                          real(8) function fmax88(x, y) result (res)
                                                                              real(8), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(4) function fmax44(x, y) result (res)
                                                                              real(4), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmax84(x, y) result(res)
                                                                              real(8), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmax48(x, y) result(res)
                                                                              real(4), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin88(x, y) result (res)
                                                                              real(8), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(4) function fmin44(x, y) result (res)
                                                                              real(4), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin84(x, y) result(res)
                                                                              real(8), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin48(x, y) result(res)
                                                                              real(4), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                          end function
                                                                      end module
                                                                      
                                                                      real(4) function code(xi, yi, zi, ux, uy, maxcos)
                                                                      use fmin_fmax_functions
                                                                          real(4), intent (in) :: xi
                                                                          real(4), intent (in) :: yi
                                                                          real(4), intent (in) :: zi
                                                                          real(4), intent (in) :: ux
                                                                          real(4), intent (in) :: uy
                                                                          real(4), intent (in) :: maxcos
                                                                          code = (zi * ux) * maxcos
                                                                      end function
                                                                      
                                                                      function code(xi, yi, zi, ux, uy, maxCos)
                                                                      	return Float32(Float32(zi * ux) * maxCos)
                                                                      end
                                                                      
                                                                      function tmp = code(xi, yi, zi, ux, uy, maxCos)
                                                                      	tmp = (zi * ux) * maxCos;
                                                                      end
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \left(zi \cdot ux\right) \cdot maxCos
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 98.7%

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

                                                                        \[\leadsto \color{blue}{maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. *-commutativeN/A

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

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

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

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

                                                                          \[\leadsto \left(\color{blue}{\left(\left(1 - ux\right) \cdot zi\right)} \cdot ux\right) \cdot maxCos \]
                                                                        6. lower-*.f32N/A

                                                                          \[\leadsto \left(\color{blue}{\left(\left(1 - ux\right) \cdot zi\right)} \cdot ux\right) \cdot maxCos \]
                                                                        7. lower--.f3213.6

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

                                                                        \[\leadsto \color{blue}{\left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos} \]
                                                                      6. Taylor expanded in ux around 0

                                                                        \[\leadsto \left(ux \cdot zi\right) \cdot maxCos \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites12.5%

                                                                          \[\leadsto \left(zi \cdot ux\right) \cdot maxCos \]
                                                                        2. Add Preprocessing

                                                                        Reproduce

                                                                        ?
                                                                        herbie shell --seed 2024356 
                                                                        (FPCore (xi yi zi ux uy maxCos)
                                                                          :name "UniformSampleCone 2"
                                                                          :precision binary32
                                                                          :pre (and (and (and (and (and (and (<= -10000.0 xi) (<= xi 10000.0)) (and (<= -10000.0 yi) (<= yi 10000.0))) (and (<= -10000.0 zi) (<= zi 10000.0))) (and (<= 2.328306437e-10 ux) (<= ux 1.0))) (and (<= 2.328306437e-10 uy) (<= uy 1.0))) (and (<= 0.0 maxCos) (<= maxCos 1.0)))
                                                                          (+ (+ (* (* (cos (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) xi) (* (* (sin (* (* uy 2.0) (PI))) (sqrt (- 1.0 (* (* (* (- 1.0 ux) maxCos) ux) (* (* (- 1.0 ux) maxCos) ux))))) yi)) (* (* (* (- 1.0 ux) maxCos) ux) zi)))