UniformSampleCone 2

Percentage Accurate: 98.9% → 99.0%
Time: 10.6s
Alternatives: 17
Speedup: 0.5×

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 17 alternatives:

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

Initial Program: 98.9% 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: 99.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\ t_1 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\ t_2 := \sin \cos^{-1} t\_0\\ \mathsf{fma}\left(\sin t\_1 \cdot t\_2, yi, \cos t\_1 \cdot \left(t\_2 \cdot xi\right)\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 (* (PI) (* 2.0 uy)))
        (t_2 (sin (acos t_0))))
   (+ (fma (* (sin t_1) t_2) yi (* (cos t_1) (* t_2 xi))) (* t_0 zi))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left(1 - ux\right) \cdot maxCos\right) \cdot ux\\
t_1 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
t_2 := \sin \cos^{-1} t\_0\\
\mathsf{fma}\left(\sin t\_1 \cdot t\_2, yi, \cos t\_1 \cdot \left(t\_2 \cdot xi\right)\right) + t\_0 \cdot zi
\end{array}
\end{array}
Derivation
  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. Applied rewrites99.1%

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

Alternative 2: 98.8% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos t\_0, xi, \sin t\_0 \cdot yi\right)\right)
\end{array}
\end{array}
Derivation
  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. associate-*r*N/A

      \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
    2. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
    3. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
    5. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
    6. lift--.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
  5. Applied rewrites99.1%

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

Alternative 3: 95.8% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
\mathsf{fma}\left(maxCos \cdot ux, zi, \mathsf{fma}\left(\cos t\_0, xi, \sin t\_0 \cdot yi\right)\right)
\end{array}
\end{array}
Derivation
  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 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. associate-*r*N/A

      \[\leadsto \left(maxCos \cdot ux\right) \cdot zi + \left(\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)\right) \]
    2. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi}, 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) \]
    3. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, zi, 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. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, zi, \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)\right) \]
    5. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, zi, \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)\right) \]
  5. Applied rewrites96.1%

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

Alternative 4: 97.2% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
t_1 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;uy \leq 0.012000000104308128:\\
\;\;\;\;xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot t\_1, -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(t\_1 \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos t\_0, xi, \sin t\_0 \cdot yi\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if uy < 0.0120000001

    1. Initial program 99.3%

      \[\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. associate-*r*N/A

        \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
      2. lower-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
      3. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      5. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      6. lift--.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
    5. Applied rewrites99.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
    7. Step-by-step derivation
      1. lower-+.f32N/A

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

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

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

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

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

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
    8. Applied rewrites99.2%

      \[\leadsto xi + \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. lift-PI.f32N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
      2. lift-pow.f32N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
      3. unpow3N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      4. pow2N/A

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

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      6. pow2N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      7. lift-*.f32N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      8. lift-PI.f32N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      9. lift-PI.f32N/A

        \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      10. lift-PI.f3299.2

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

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

    if 0.0120000001 < uy

    1. Initial program 98.1%

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

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

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

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

Alternative 5: 93.1% accurate, 2.1× speedup?

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

\\
\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \left(xi - 2 \cdot \left(\left(uy \cdot uy\right) \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\right)
\end{array}
Derivation
  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. associate-*r*N/A

      \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
    2. lower-fma.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
    3. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
    5. lower-*.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
    6. lift--.f32N/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
  5. Applied rewrites99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \left(xi + -2 \cdot \left({uy}^{2} \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) + \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\right) \]
  9. Step-by-step derivation
    1. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \left(xi - 2 \cdot \left(\left(uy \cdot uy\right) \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) + \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\right) \]
    8. pow2N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \left(xi - 2 \cdot \left(\left(uy \cdot uy\right) \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\right) \]
    12. lift-*.f3292.5

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

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

Alternative 6: 92.0% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\ t_1 := \left(1 - ux\right) \cdot zi\\ \mathbf{if}\;yi \leq 1.000000031374395 \cdot 10^{-22}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, t\_1, \mathsf{fma}\left(\cos t\_0, xi, \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, t\_1, xi + \sin t\_0 \cdot yi\right)\\ \end{array} \end{array} \]
(FPCore (xi yi zi ux uy maxCos)
 :precision binary32
 (let* ((t_0 (* (PI) (* 2.0 uy))) (t_1 (* (- 1.0 ux) zi)))
   (if (<= yi 1.000000031374395e-22)
     (fma (* maxCos ux) t_1 (fma (cos t_0) xi (* (* 2.0 (* uy (PI))) yi)))
     (fma (* maxCos ux) t_1 (+ xi (* (sin t_0) yi))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\\
t_1 := \left(1 - ux\right) \cdot zi\\
\mathbf{if}\;yi \leq 1.000000031374395 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, t\_1, \mathsf{fma}\left(\cos t\_0, xi, \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(maxCos \cdot ux, t\_1, xi + \sin t\_0 \cdot yi\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if yi < 1.00000003e-22

    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. associate-*r*N/A

        \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
      2. lower-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
      3. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      5. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      6. lift--.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
    5. Applied rewrites99.1%

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

      \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \left(2 \cdot \left(uy \cdot \mathsf{PI}\left(\right)\right)\right) \cdot yi\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f32N/A

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

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

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

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

    if 1.00000003e-22 < yi

    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. associate-*r*N/A

        \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
      2. lower-fma.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
      3. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      5. lower-*.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
      6. lift--.f32N/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
    5. Applied rewrites98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 92.0% accurate, 2.5× speedup?

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

      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. associate-*r*N/A

          \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
        2. lower-fma.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
        3. lower-*.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
        5. lower-*.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
        6. lift--.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
      5. Applied rewrites99.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
      7. Step-by-step derivation
        1. lower-+.f32N/A

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

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

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

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

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

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
      8. Applied rewrites97.0%

        \[\leadsto xi + \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
      9. Step-by-step derivation
        1. lift-PI.f32N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
        2. lift-pow.f32N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
        3. unpow3N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        4. pow2N/A

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

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        6. pow2N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        7. lift-*.f32N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        8. lift-PI.f32N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        9. lift-PI.f32N/A

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        10. lift-PI.f3297.0

          \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
      10. Applied rewrites97.0%

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

      if 0.0700000003 < uy

      1. Initial program 97.6%

        \[\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. associate-*r*N/A

          \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
        2. lower-fma.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
        3. lower-*.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
        5. lower-*.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
        6. lift--.f32N/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
      5. Applied rewrites97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 91.2% accurate, 2.8× speedup?

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

        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. associate-*r*N/A

            \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
          2. lower-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
          3. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          5. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          6. lift--.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
        5. Applied rewrites99.3%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
        7. Step-by-step derivation
          1. lower-+.f32N/A

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

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

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

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

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
        8. Applied rewrites97.0%

          \[\leadsto xi + \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
        9. Step-by-step derivation
          1. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
          2. lift-pow.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
          3. unpow3N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          4. pow2N/A

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          6. pow2N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          7. lift-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          8. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          9. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          10. lift-PI.f3297.0

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied rewrites97.0%

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

        if 0.0700000003 < uy

        1. Initial program 97.6%

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

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

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

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

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

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

        Alternative 9: 89.5% accurate, 4.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\ xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot t\_0, -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(t\_0 \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \end{array} \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (let* ((t_0 (* (PI) (PI))))
           (+
            xi
            (fma
             maxCos
             (* ux (* zi (- 1.0 ux)))
             (*
              uy
              (fma
               2.0
               (* yi (PI))
               (*
                uy
                (fma
                 -2.0
                 (* xi t_0)
                 (* -1.3333333333333333 (* uy (* yi (* t_0 (PI)))))))))))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
        xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot t\_0, -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(t\_0 \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right)
        \end{array}
        \end{array}
        
        Derivation
        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. associate-*r*N/A

            \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
          2. lower-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
          3. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          5. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          6. lift--.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
        5. Applied rewrites99.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
        7. Step-by-step derivation
          1. lower-+.f32N/A

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

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

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

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

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \left(2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right) + uy \cdot \left(-2 \cdot \left(xi \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
        8. Applied rewrites87.5%

          \[\leadsto xi + \color{blue}{\mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right)} \]
        9. Step-by-step derivation
          1. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
          2. lift-pow.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)\right)\right)\right) \]
          3. unpow3N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          4. pow2N/A

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          6. pow2N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          7. lift-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          8. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          9. lift-PI.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{-4}{3} \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
          10. lift-PI.f3287.5

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(2, yi \cdot \mathsf{PI}\left(\right), uy \cdot \mathsf{fma}\left(-2, xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), -1.3333333333333333 \cdot \left(uy \cdot \left(yi \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied rewrites87.5%

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

        Alternative 10: 86.0% accurate, 5.0× speedup?

        \[\begin{array}{l} \\ xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - ux\right), \frac{uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}{maxCos}\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (+
          xi
          (*
           maxCos
           (fma
            ux
            (* zi (- 1.0 ux))
            (/
             (* uy (fma -2.0 (* uy (* xi (* (PI) (PI)))) (* 2.0 (* yi (PI)))))
             maxCos)))))
        \begin{array}{l}
        
        \\
        xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - ux\right), \frac{uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)}{maxCos}\right)
        \end{array}
        
        Derivation
        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. associate-*r*N/A

            \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
          2. lower-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
          3. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          5. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          6. lift--.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
        5. Applied rewrites99.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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. lower-+.f32N/A

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(zi \cdot \left(1 - ux\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. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \color{blue}{\left(1 - ux\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) \]
          4. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - \color{blue}{ux}\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) \]
          5. lift--.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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) \]
          6. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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. lower-fma.f32N/A

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

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

          \[\leadsto xi + maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right) + \color{blue}{\frac{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)}{maxCos}}\right) \]
        10. Step-by-step derivation
          1. lower-*.f32N/A

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

            \[\leadsto xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - \color{blue}{ux}\right), \frac{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)}{maxCos}\right) \]
          3. lift-*.f32N/A

            \[\leadsto xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - ux\right), \frac{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)}{maxCos}\right) \]
          4. lift--.f32N/A

            \[\leadsto xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - ux\right), \frac{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)}{maxCos}\right) \]
          5. lower-/.f32N/A

            \[\leadsto xi + maxCos \cdot \mathsf{fma}\left(ux, zi \cdot \left(1 - ux\right), \frac{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)}{maxCos}\right) \]
        11. Applied rewrites83.5%

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

        Alternative 11: 86.1% accurate, 6.0× speedup?

        \[\begin{array}{l} \\ xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (+
          xi
          (fma
           maxCos
           (* ux (* zi (- 1.0 ux)))
           (* uy (fma -2.0 (* uy (* xi (* (PI) (PI)))) (* 2.0 (* yi (PI))))))))
        \begin{array}{l}
        
        \\
        xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\right)\right), uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)
        \end{array}
        
        Derivation
        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. associate-*r*N/A

            \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
          2. lower-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
          3. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          5. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          6. lift--.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
        5. Applied rewrites99.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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. lower-+.f32N/A

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(zi \cdot \left(1 - ux\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. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \color{blue}{\left(1 - ux\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) \]
          4. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - \color{blue}{ux}\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) \]
          5. lift--.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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) \]
          6. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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. lower-fma.f32N/A

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

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

        Alternative 12: 83.4% accurate, 6.9× speedup?

        \[\begin{array}{l} \\ xi + \mathsf{fma}\left(maxCos, ux \cdot zi, uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \end{array} \]
        (FPCore (xi yi zi ux uy maxCos)
         :precision binary32
         (+
          xi
          (fma
           maxCos
           (* ux zi)
           (* uy (fma -2.0 (* uy (* xi (* (PI) (PI)))) (* 2.0 (* yi (PI))))))))
        \begin{array}{l}
        
        \\
        xi + \mathsf{fma}\left(maxCos, ux \cdot zi, uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)
        \end{array}
        
        Derivation
        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. associate-*r*N/A

            \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
          2. lower-fma.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
          3. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          5. lower-*.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
          6. lift--.f32N/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
        5. Applied rewrites99.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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. lower-+.f32N/A

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(zi \cdot \left(1 - ux\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. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \color{blue}{\left(1 - ux\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) \]
          4. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - \color{blue}{ux}\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) \]
          5. lift--.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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) \]
          6. lower-*.f32N/A

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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. lower-fma.f32N/A

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

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

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

            \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot zi, uy \cdot \mathsf{fma}\left(-2, uy \cdot \left(xi \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 2 \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          2. Final simplification80.9%

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

          Alternative 13: 82.0% accurate, 9.3× speedup?

          \[\begin{array}{l} \\ \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \end{array} \]
          (FPCore (xi yi zi ux uy maxCos)
           :precision binary32
           (fma (* maxCos ux) (* (- 1.0 ux) zi) (+ xi (* 2.0 (* uy (* yi (PI)))))))
          \begin{array}{l}
          
          \\
          \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right)
          \end{array}
          
          Derivation
          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. associate-*r*N/A

              \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
            2. lower-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
            3. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            5. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            6. lift--.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
          5. Applied rewrites99.1%

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

            \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          7. Step-by-step derivation
            1. lower-+.f32N/A

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

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

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

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
            5. lift-PI.f3279.3

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
          8. Applied rewrites79.3%

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

          Alternative 14: 82.0% accurate, 9.3× speedup?

          \[\begin{array}{l} \\ xi + \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \end{array} \]
          (FPCore (xi yi zi ux uy maxCos)
           :precision binary32
           (+ xi (fma 2.0 (* uy (* yi (PI))) (* maxCos (* ux (* zi (- 1.0 ux)))))))
          \begin{array}{l}
          
          \\
          xi + \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right)
          \end{array}
          
          Derivation
          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. associate-*r*N/A

              \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
            2. lower-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
            3. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            5. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            6. lift--.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
          5. Applied rewrites99.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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 \left(zi \cdot \left(1 - ux\right)\right)\right)\right)} \]
          7. Step-by-step derivation
            1. lower-+.f32N/A

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

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

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

              \[\leadsto xi + \mathsf{fma}\left(2, uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right), maxCos \cdot \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right)\right) \]
            5. lift-PI.f32N/A

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

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

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

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

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

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

          Alternative 15: 74.7% accurate, 18.6× speedup?

          \[\begin{array}{l} \\ xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \end{array} \]
          (FPCore (xi yi zi ux uy maxCos)
           :precision binary32
           (+ xi (* 2.0 (* uy (* yi (PI))))))
          \begin{array}{l}
          
          \\
          xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)
          \end{array}
          
          Derivation
          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. associate-*r*N/A

              \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
            2. lower-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
            3. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            5. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            6. lift--.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
          5. Applied rewrites99.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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. lower-+.f32N/A

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

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(zi \cdot \left(1 - ux\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. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \color{blue}{\left(1 - ux\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) \]
            4. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - \color{blue}{ux}\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) \]
            5. lift--.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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) \]
            6. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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. lower-fma.f32N/A

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

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

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

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

              \[\leadsto xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            3. lift-*.f32N/A

              \[\leadsto xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            4. lift-PI.f3271.6

              \[\leadsto xi + 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
          11. Applied rewrites71.6%

            \[\leadsto xi + 2 \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right) \]
          12. Add Preprocessing

          Alternative 16: 32.2% accurate, 22.1× speedup?

          \[\begin{array}{l} \\ 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \end{array} \]
          (FPCore (xi yi zi ux uy maxCos) :precision binary32 (* 2.0 (* uy (* yi (PI)))))
          \begin{array}{l}
          
          \\
          2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right)
          \end{array}
          
          Derivation
          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. associate-*r*N/A

              \[\leadsto \left(maxCos \cdot ux\right) \cdot \left(zi \cdot \left(1 - ux\right)\right) + \left(\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)\right) \]
            2. lower-fma.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi \cdot \left(1 - ux\right)}, 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) \]
            3. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \color{blue}{zi} \cdot \left(1 - ux\right), 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. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            5. lower-*.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot \color{blue}{zi}, 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) \]
            6. lift--.f32N/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, 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) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \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)\right) \]
          5. Applied rewrites99.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(maxCos \cdot ux, \left(1 - ux\right) \cdot zi, \mathsf{fma}\left(\cos \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right), xi, \sin \left(\mathsf{PI}\left(\right) \cdot \left(2 \cdot uy\right)\right) \cdot yi\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. lower-+.f32N/A

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

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \color{blue}{\left(zi \cdot \left(1 - ux\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. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \color{blue}{\left(1 - ux\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) \]
            4. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - \color{blue}{ux}\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) \]
            5. lift--.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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) \]
            6. lower-*.f32N/A

              \[\leadsto xi + \mathsf{fma}\left(maxCos, ux \cdot \left(zi \cdot \left(1 - ux\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. lower-fma.f32N/A

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

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

            \[\leadsto 2 \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right) \]
          10. Step-by-step derivation
            1. lower-*.f32N/A

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

              \[\leadsto 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            3. lift-*.f32N/A

              \[\leadsto 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
            4. lift-PI.f3228.4

              \[\leadsto 2 \cdot \left(uy \cdot \left(yi \cdot \mathsf{PI}\left(\right)\right)\right) \]
          11. Applied rewrites28.4%

            \[\leadsto 2 \cdot \left(uy \cdot \color{blue}{\left(yi \cdot \mathsf{PI}\left(\right)\right)}\right) \]
          12. Add Preprocessing

          Alternative 17: 11.9% 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 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 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 \left(ux \cdot \left(zi \cdot \left(1 - ux\right)\right)\right) \cdot \color{blue}{maxCos} \]
            2. lower-*.f32N/A

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

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

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

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

              \[\leadsto \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos \]
            7. lift--.f3213.5

              \[\leadsto \left(\left(\left(1 - ux\right) \cdot zi\right) \cdot ux\right) \cdot maxCos \]
          5. Applied rewrites13.5%

            \[\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(zi \cdot ux\right) \cdot maxCos \]
          7. Step-by-step derivation
            1. Applied rewrites12.1%

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

            Reproduce

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