ab-angle->ABCF C

Percentage Accurate: 79.4% → 79.4%
Time: 17.8s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* (PI) (/ angle 180.0))))
   (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* (PI) (/ angle 180.0))))
   (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}

Alternative 1: 79.4% accurate, 0.6× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log angle\_m - \log 180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle\_m}}\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (pow (* a (cos (* (PI) (exp (- (log angle_m) (log 180.0)))))) 2.0)
  (pow (* b (sin (* (/ (PI) 180.0) (/ 1.0 (/ 1.0 angle_m))))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log angle\_m - \log 180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle\_m}}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
    3. clear-numN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{1}{\frac{180}{angle}}}\right)\right)}^{2} \]
    4. associate-*r/N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot 1}{\frac{180}{angle}}\right)}\right)}^{2} \]
    5. div-invN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot 1}{\color{blue}{180 \cdot \frac{1}{angle}}}\right)\right)}^{2} \]
    6. times-fracN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)}\right)}^{2} \]
    7. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)}\right)}^{2} \]
    8. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{180}} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    9. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \color{blue}{\frac{1}{\frac{1}{angle}}}\right)\right)}^{2} \]
    10. lower-/.f6479.6

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\color{blue}{\frac{1}{angle}}}\right)\right)}^{2} \]
  4. Applied rewrites79.6%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)}\right)}^{2} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    2. clear-numN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{1}{\frac{180}{angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    3. inv-powN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(\frac{180}{angle}\right)}^{-1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    4. pow-to-expN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{e^{\log \left(\frac{180}{angle}\right) \cdot -1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    5. lower-exp.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{e^{\log \left(\frac{180}{angle}\right) \cdot -1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    6. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log \left(\frac{180}{angle}\right) \cdot -1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    7. lower-log.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log \left(\frac{180}{angle}\right)} \cdot -1}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    8. lower-/.f6444.7

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log \color{blue}{\left(\frac{180}{angle}\right)} \cdot -1}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
  6. Applied rewrites44.7%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{e^{\log \left(\frac{180}{angle}\right) \cdot -1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log \left(\frac{180}{angle}\right) \cdot -1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    2. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{-1 \cdot \log \left(\frac{180}{angle}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    3. lift-log.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{-1 \cdot \color{blue}{\log \left(\frac{180}{angle}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    4. log-powN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log \left({\left(\frac{180}{angle}\right)}^{-1}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    5. inv-powN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log \color{blue}{\left(\frac{1}{\frac{180}{angle}}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    6. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log \left(\frac{1}{\color{blue}{\frac{180}{angle}}}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    7. clear-numN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log \color{blue}{\left(\frac{angle}{180}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    8. log-divN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log angle - \log 180}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    9. lower--.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log angle - \log 180}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    10. lower-log.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log angle} - \log 180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
    11. lower-log.f6444.7

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\log angle - \color{blue}{\log 180}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
  8. Applied rewrites44.7%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot e^{\color{blue}{\log angle - \log 180}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{180} \cdot \frac{1}{\frac{1}{angle}}\right)\right)}^{2} \]
  9. Add Preprocessing

Alternative 2: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle\_m}{180}\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (pow (* a (cos (* (PI) (/ angle_m 180.0)))) 2.0)
  (pow (* b (sin (/ (* (PI) angle_m) 180.0))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle\_m}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
    3. associate-*r/N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    4. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    5. lower-*.f6479.6

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot angle}}{180}\right)\right)}^{2} \]
  4. Applied rewrites79.6%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
  5. Add Preprocessing

Alternative 3: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right)\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (pow (* a (cos (* (PI) (/ angle_m 180.0)))) 2.0)
  (pow (* b (sin (* angle_m (* (PI) 0.005555555555555556)))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} \]
    3. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\frac{angle}{180}} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
    4. div-invN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
    5. associate-*l*N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(angle \cdot \left(\frac{1}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
    6. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\frac{1}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}\right)}^{2} \]
    7. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\frac{1}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}\right)}^{2} \]
    8. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{180}\right)} \cdot angle\right)\right)}^{2} \]
    9. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{180}\right)} \cdot angle\right)\right)}^{2} \]
    10. metadata-eval79.6

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{0.005555555555555556}\right) \cdot angle\right)\right)}^{2} \]
  4. Applied rewrites79.6%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)}\right)}^{2} \]
  5. Final simplification79.6%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  6. Add Preprocessing

Alternative 4: 79.4% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle\_m}{180}\right)\right)}^{2} + a \cdot a \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+ (pow (* b (sin (/ (* (PI) angle_m) 180.0))) 2.0) (* a a)))
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle\_m}{180}\right)\right)}^{2} + a \cdot a
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
    3. associate-*r/N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    4. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    5. lower-*.f6479.6

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot angle}}{180}\right)\right)}^{2} \]
  4. Applied rewrites79.6%

    \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
  5. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
  6. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    2. lower-*.f6479.2

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
  7. Applied rewrites79.2%

    \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
  8. Final simplification79.2%

    \[\leadsto {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} + a \cdot a \]
  9. Add Preprocessing

Alternative 5: 79.4% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ a \cdot a + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+ (* a a) (pow (* b (sin (* (PI) (/ angle_m 180.0)))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|

\\
a \cdot a + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. lower-*.f6479.1

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  5. Applied rewrites79.1%

    \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  6. Add Preprocessing

Alternative 6: 75.1% accurate, 2.4× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+33}:\\ \;\;\;\;\mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle\_m \cdot angle\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + t\_0\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(a, a \cdot 1, b \cdot \left(b \cdot \left(0.5 - t\_0\right)\right)\right)}}\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (let* ((t_0 (* 0.5 (cos (* 2.0 (* (PI) (* angle_m 0.005555555555555556)))))))
   (if (<= (/ angle_m 180.0) 2e+33)
     (fma
      (* (* b (* (PI) (PI))) (* (* angle_m angle_m) 3.08641975308642e-5))
      b
      (* a (* a (+ 0.5 t_0))))
     (/ 1.0 (/ 1.0 (fma a (* a 1.0) (* b (* b (- 0.5 t_0)))))))))
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle\_m \cdot angle\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + t\_0\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(a, a \cdot 1, b \cdot \left(b \cdot \left(0.5 - t\_0\right)\right)\right)}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle #s(literal 180 binary64)) < 1.9999999999999999e33

    1. Initial program 87.6%

      \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. Add Preprocessing
    3. Applied rewrites62.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}, b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{32400} \cdot \left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{1}{32400} \cdot {angle}^{2}\right) \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)} \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      7. lower-PI.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      8. lower-PI.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({angle}^{2} \cdot \frac{1}{32400}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({angle}^{2} \cdot \frac{1}{32400}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(angle \cdot angle\right)} \cdot \frac{1}{32400}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      12. lower-*.f6480.3

        \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(angle \cdot angle\right)} \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right) \]
    6. Applied rewrites80.3%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)}, b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right) \]

    if 1.9999999999999999e33 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 57.6%

      \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. Add Preprocessing
    3. Applied rewrites57.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(a, a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right), b \cdot \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)}}} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(a, a \cdot \color{blue}{1}, b \cdot \left(b \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. Applied rewrites57.8%

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(a, a \cdot \color{blue}{1}, b \cdot \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)}} \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 7: 65.0% accurate, 2.6× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle\_m \cdot angle\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (if (<= b 4.2e-84)
       (* (* a a) (fma 0.5 (cos (* angle_m (* (PI) 0.011111111111111112))) 0.5))
       (fma
        (* (* b (* (PI) (PI))) (* (* angle_m angle_m) 3.08641975308642e-5))
        b
        (*
         a
         (*
          a
          (+
           0.5
           (* 0.5 (cos (* 2.0 (* (PI) (* angle_m 0.005555555555555556)))))))))))
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\
    \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle\_m \cdot angle\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 4.19999999999999996e-84

      1. Initial program 77.3%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Applied rewrites72.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(b \cdot b\right), \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right), a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
      4. Taylor expanded in b around 0

        \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        4. +-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2}\right)} \]
        5. lower-fma.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{2}\right)} \]
        6. lower-cos.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}, \frac{1}{2}\right) \]
        7. *-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right), \frac{1}{2}\right) \]
        8. associate-*r*N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        9. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        10. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)} \cdot angle\right), \frac{1}{2}\right) \]
        11. lower-PI.f6459.3

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot angle\right), 0.5\right) \]
      6. Applied rewrites59.3%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right), 0.5\right)} \]

      if 4.19999999999999996e-84 < b

      1. Initial program 85.6%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Applied rewrites70.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}, b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
      4. Taylor expanded in angle around 0

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{32400} \cdot \left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
      5. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{1}{32400} \cdot {angle}^{2}\right) \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        4. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)} \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        6. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        7. lower-PI.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        8. lower-PI.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\frac{1}{32400} \cdot {angle}^{2}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({angle}^{2} \cdot \frac{1}{32400}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        10. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({angle}^{2} \cdot \frac{1}{32400}\right)}, b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(angle \cdot angle\right)} \cdot \frac{1}{32400}\right), b, a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)\right) \]
        12. lower-*.f6479.7

          \[\leadsto \mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(angle \cdot angle\right)} \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right) \]
      6. Applied rewrites79.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)}, b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right) \]
    3. Recombined 2 regimes into one program.
    4. Final simplification64.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 65.1% accurate, 2.7× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot angle\_m\right) \cdot \left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\ \end{array} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (if (<= b 4.2e-84)
       (* (* a a) (fma 0.5 (cos (* angle_m (* (PI) 0.011111111111111112))) 0.5))
       (fma
        (* (* angle_m angle_m) (* b (* (* (PI) (PI)) 3.08641975308642e-5)))
        b
        (*
         (* a a)
         (fma 0.5 (cos (* (* (PI) angle_m) 0.011111111111111112)) 0.5)))))
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\
    \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot angle\_m\right) \cdot \left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 4.19999999999999996e-84

      1. Initial program 77.3%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Applied rewrites72.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(b \cdot b\right), \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right), a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
      4. Taylor expanded in b around 0

        \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        4. +-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2}\right)} \]
        5. lower-fma.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{2}\right)} \]
        6. lower-cos.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}, \frac{1}{2}\right) \]
        7. *-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right), \frac{1}{2}\right) \]
        8. associate-*r*N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        9. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        10. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)} \cdot angle\right), \frac{1}{2}\right) \]
        11. lower-PI.f6459.3

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot angle\right), 0.5\right) \]
      6. Applied rewrites59.3%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right), 0.5\right)} \]

      if 4.19999999999999996e-84 < b

      1. Initial program 85.6%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
        2. lift-/.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
        3. associate-*r/N/A

          \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
        4. lower-/.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
        5. lower-*.f6485.7

          \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot angle}}{180}\right)\right)}^{2} \]
      4. Applied rewrites85.7%

        \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
      5. Applied rewrites82.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right), b, \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right) \cdot \left(a \cdot a\right)\right)} \]
      6. Taylor expanded in angle around 0

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{32400} \cdot \left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) \cdot \frac{1}{32400}}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        2. associate-*r*N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{{angle}^{2} \cdot \left(\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \frac{1}{32400}\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left({angle}^{2} \cdot \color{blue}{\left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        4. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{{angle}^{2} \cdot \left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(angle \cdot angle\right)} \cdot \left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        6. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(angle \cdot angle\right)} \cdot \left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \color{blue}{\left(\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \frac{1}{32400}\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        8. associate-*l*N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \color{blue}{\left(b \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \frac{1}{32400}\right)\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \color{blue}{\left(\frac{1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        10. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \color{blue}{\left(b \cdot \left(\frac{1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{2} \cdot \frac{1}{32400}\right)}\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        12. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{2} \cdot \frac{1}{32400}\right)}\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        13. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{32400}\right)\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        14. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{32400}\right)\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        15. lower-PI.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right), b, \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right) \cdot \left(a \cdot a\right)\right) \]
        16. lower-PI.f6479.6

          \[\leadsto \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), b, \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right) \cdot \left(a \cdot a\right)\right) \]
      8. Applied rewrites79.6%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)}, b, \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right) \cdot \left(a \cdot a\right)\right) \]
    3. Recombined 2 regimes into one program.
    4. Final simplification64.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(angle \cdot angle\right) \cdot \left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 63.0% accurate, 3.4× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle\_m, a \cdot a\right)\\ \end{array} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (if (<= b 4.2e-84)
       (* (* a a) (fma 0.5 (cos (* angle_m (* (PI) 0.011111111111111112))) 0.5))
       (if (<= b 1.2e+147)
         (fma
          (* angle_m angle_m)
          (* (* (PI) (PI)) (* b (* b 3.08641975308642e-5)))
          (* a a))
         (fma
          (*
           (* (PI) angle_m)
           (*
            (PI)
            (fma a (* a -3.08641975308642e-5) (* 3.08641975308642e-5 (* b b)))))
          angle_m
          (* a a)))))
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\
    \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\
    
    \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\
    \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle\_m, a \cdot a\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if b < 4.19999999999999996e-84

      1. Initial program 77.3%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Applied rewrites72.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(b \cdot b\right), \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right), a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
      4. Taylor expanded in b around 0

        \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        4. +-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2}\right)} \]
        5. lower-fma.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{2}\right)} \]
        6. lower-cos.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}, \frac{1}{2}\right) \]
        7. *-commutativeN/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right), \frac{1}{2}\right) \]
        8. associate-*r*N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        9. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}, \frac{1}{2}\right) \]
        10. lower-*.f64N/A

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)} \cdot angle\right), \frac{1}{2}\right) \]
        11. lower-PI.f6459.3

          \[\leadsto \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot angle\right), 0.5\right) \]
      6. Applied rewrites59.3%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(0.011111111111111112 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right), 0.5\right)} \]

      if 4.19999999999999996e-84 < b < 1.20000000000000001e147

      1. Initial program 77.7%

        \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. unpow1N/A

          \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        2. metadata-evalN/A

          \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        3. pow-prod-upN/A

          \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        4. pow2N/A

          \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        5. lower-pow.f64N/A

          \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        6. unpow1/2N/A

          \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        7. lower-sqrt.f6470.3

          \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        8. lift-/.f64N/A

          \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        9. div-invN/A

          \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        10. lower-*.f64N/A

          \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        11. metadata-eval70.8

          \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      4. Applied rewrites70.8%

        \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      5. Taylor expanded in angle around 0

        \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
      6. Step-by-step derivation
        1. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
      7. Applied rewrites40.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
      8. Taylor expanded in a around 0

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\frac{1}{32400} \cdot \color{blue}{{b}^{2}}\right), a \cdot a\right) \]
      9. Step-by-step derivation
        1. Applied rewrites74.8%

          \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)}\right), a \cdot a\right) \]

        if 1.20000000000000001e147 < b

        1. Initial program 95.0%

          \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. unpow1N/A

            \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          2. metadata-evalN/A

            \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          3. pow-prod-upN/A

            \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          4. pow2N/A

            \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          5. lower-pow.f64N/A

            \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          6. unpow1/2N/A

            \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          7. lower-sqrt.f6471.7

            \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          8. lift-/.f64N/A

            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          9. div-invN/A

            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          10. lower-*.f64N/A

            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          11. metadata-eval71.7

            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        4. Applied rewrites71.7%

          \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        5. Taylor expanded in angle around 0

          \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
        6. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
        7. Applied rewrites60.4%

          \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
        8. Step-by-step derivation
          1. Applied rewrites79.4%

            \[\leadsto \mathsf{fma}\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), \color{blue}{angle}, a \cdot a\right) \]
        9. Recombined 3 regimes into one program.
        10. Final simplification64.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), 0.5\right)\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle, a \cdot a\right)\\ \end{array} \]
        11. Add Preprocessing

        Alternative 10: 63.0% accurate, 7.5× speedup?

        \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle\_m, a \cdot a\right)\\ \end{array} \end{array} \]
        angle_m = (fabs.f64 angle)
        (FPCore (a b angle_m)
         :precision binary64
         (if (<= b 4.2e-84)
           (* a a)
           (if (<= b 1.2e+147)
             (fma
              (* angle_m angle_m)
              (* (* (PI) (PI)) (* b (* b 3.08641975308642e-5)))
              (* a a))
             (fma
              (*
               (* (PI) angle_m)
               (*
                (PI)
                (fma a (* a -3.08641975308642e-5) (* 3.08641975308642e-5 (* b b)))))
              angle_m
              (* a a)))))
        \begin{array}{l}
        angle_m = \left|angle\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\
        \;\;\;\;a \cdot a\\
        
        \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\
        \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\_m\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle\_m, a \cdot a\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if b < 4.19999999999999996e-84

          1. Initial program 77.3%

            \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          2. Add Preprocessing
          3. Taylor expanded in angle around 0

            \[\leadsto \color{blue}{{a}^{2}} \]
          4. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \color{blue}{a \cdot a} \]
            2. lower-*.f6458.7

              \[\leadsto \color{blue}{a \cdot a} \]
          5. Applied rewrites58.7%

            \[\leadsto \color{blue}{a \cdot a} \]

          if 4.19999999999999996e-84 < b < 1.20000000000000001e147

          1. Initial program 77.7%

            \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. unpow1N/A

              \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            2. metadata-evalN/A

              \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            3. pow-prod-upN/A

              \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            4. pow2N/A

              \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            5. lower-pow.f64N/A

              \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            6. unpow1/2N/A

              \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            7. lower-sqrt.f6470.3

              \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            8. lift-/.f64N/A

              \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            9. div-invN/A

              \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            10. lower-*.f64N/A

              \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            11. metadata-eval70.8

              \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          4. Applied rewrites70.8%

            \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
          5. Taylor expanded in angle around 0

            \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
          6. Step-by-step derivation
            1. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
          7. Applied rewrites40.2%

            \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
          8. Taylor expanded in a around 0

            \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\frac{1}{32400} \cdot \color{blue}{{b}^{2}}\right), a \cdot a\right) \]
          9. Step-by-step derivation
            1. Applied rewrites74.8%

              \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)}\right), a \cdot a\right) \]

            if 1.20000000000000001e147 < b

            1. Initial program 95.0%

              \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. unpow1N/A

                \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              2. metadata-evalN/A

                \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              3. pow-prod-upN/A

                \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              4. pow2N/A

                \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              5. lower-pow.f64N/A

                \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              6. unpow1/2N/A

                \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              7. lower-sqrt.f6471.7

                \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              8. lift-/.f64N/A

                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              9. div-invN/A

                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              10. lower-*.f64N/A

                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              11. metadata-eval71.7

                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            4. Applied rewrites71.7%

              \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            5. Taylor expanded in angle around 0

              \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
            6. Step-by-step derivation
              1. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
            7. Applied rewrites60.4%

              \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
            8. Step-by-step derivation
              1. Applied rewrites79.4%

                \[\leadsto \mathsf{fma}\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), \color{blue}{angle}, a \cdot a\right) \]
            9. Recombined 3 regimes into one program.
            10. Final simplification63.7%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(a, a \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), angle, a \cdot a\right)\\ \end{array} \]
            11. Add Preprocessing

            Alternative 11: 64.5% accurate, 9.1× speedup?

            \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+155}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, t\_0 \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot b\right)\right)\\ \end{array} \end{array} \]
            angle_m = (fabs.f64 angle)
            (FPCore (a b angle_m)
             :precision binary64
             (let* ((t_0 (* (PI) (PI))))
               (if (<= b 4.2e-84)
                 (* a a)
                 (if (<= b 8.2e+155)
                   (fma
                    (* angle_m angle_m)
                    (* t_0 (* b (* b 3.08641975308642e-5)))
                    (* a a))
                   (* (* t_0 3.08641975308642e-5) (* (* angle_m b) (* angle_m b)))))))
            \begin{array}{l}
            angle_m = \left|angle\right|
            
            \\
            \begin{array}{l}
            t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
            \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\
            \;\;\;\;a \cdot a\\
            
            \mathbf{elif}\;b \leq 8.2 \cdot 10^{+155}:\\
            \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, t\_0 \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot b\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if b < 4.19999999999999996e-84

              1. Initial program 77.3%

                \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              2. Add Preprocessing
              3. Taylor expanded in angle around 0

                \[\leadsto \color{blue}{{a}^{2}} \]
              4. Step-by-step derivation
                1. unpow2N/A

                  \[\leadsto \color{blue}{a \cdot a} \]
                2. lower-*.f6458.7

                  \[\leadsto \color{blue}{a \cdot a} \]
              5. Applied rewrites58.7%

                \[\leadsto \color{blue}{a \cdot a} \]

              if 4.19999999999999996e-84 < b < 8.1999999999999996e155

              1. Initial program 75.5%

                \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. unpow1N/A

                  \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                2. metadata-evalN/A

                  \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                3. pow-prod-upN/A

                  \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                4. pow2N/A

                  \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                5. lower-pow.f64N/A

                  \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                6. unpow1/2N/A

                  \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                7. lower-sqrt.f6467.6

                  \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                8. lift-/.f64N/A

                  \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                9. div-invN/A

                  \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                10. lower-*.f64N/A

                  \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                11. metadata-eval68.0

                  \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              4. Applied rewrites68.0%

                \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
              5. Taylor expanded in angle around 0

                \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
              6. Step-by-step derivation
                1. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
              7. Applied rewrites37.9%

                \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
              8. Taylor expanded in a around 0

                \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\frac{1}{32400} \cdot \color{blue}{{b}^{2}}\right), a \cdot a\right) \]
              9. Step-by-step derivation
                1. Applied rewrites70.0%

                  \[\leadsto \mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)}\right), a \cdot a\right) \]

                if 8.1999999999999996e155 < b

                1. Initial program 99.9%

                  \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. unpow1N/A

                    \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  2. metadata-evalN/A

                    \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  3. pow-prod-upN/A

                    \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  4. pow2N/A

                    \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  5. lower-pow.f64N/A

                    \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  6. unpow1/2N/A

                    \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  7. lower-sqrt.f6475.8

                    \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  8. lift-/.f64N/A

                    \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  9. div-invN/A

                    \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  10. lower-*.f64N/A

                    \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  11. metadata-eval75.8

                    \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                4. Applied rewrites75.8%

                  \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                5. Taylor expanded in angle around 0

                  \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
                6. Step-by-step derivation
                  1. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
                7. Applied rewrites65.8%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
                8. Taylor expanded in a around 0

                  \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({angle}^{2} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                9. Step-by-step derivation
                  1. Applied rewrites76.6%

                    \[\leadsto \left(\left(b \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                  2. Step-by-step derivation
                    1. Applied rewrites83.4%

                      \[\leadsto \left(\left(angle \cdot b\right) \cdot \left(angle \cdot b\right)\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \]
                  3. Recombined 3 regimes into one program.
                  4. Final simplification63.3%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-84}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+155}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot \left(b \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle \cdot b\right) \cdot \left(angle \cdot b\right)\right)\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 12: 62.8% accurate, 12.1× speedup?

                  \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot b\right)\right)\\ \end{array} \end{array} \]
                  angle_m = (fabs.f64 angle)
                  (FPCore (a b angle_m)
                   :precision binary64
                   (if (<= b 1.75e+156)
                     (* a a)
                     (* (* (* (PI) (PI)) 3.08641975308642e-5) (* (* angle_m b) (* angle_m b)))))
                  \begin{array}{l}
                  angle_m = \left|angle\right|
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\
                  \;\;\;\;a \cdot a\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot b\right)\right)\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if b < 1.7500000000000002e156

                    1. Initial program 77.0%

                      \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                    2. Add Preprocessing
                    3. Taylor expanded in angle around 0

                      \[\leadsto \color{blue}{{a}^{2}} \]
                    4. Step-by-step derivation
                      1. unpow2N/A

                        \[\leadsto \color{blue}{a \cdot a} \]
                      2. lower-*.f6459.8

                        \[\leadsto \color{blue}{a \cdot a} \]
                    5. Applied rewrites59.8%

                      \[\leadsto \color{blue}{a \cdot a} \]

                    if 1.7500000000000002e156 < b

                    1. Initial program 99.9%

                      \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. unpow1N/A

                        \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      2. metadata-evalN/A

                        \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      3. pow-prod-upN/A

                        \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      4. pow2N/A

                        \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      5. lower-pow.f64N/A

                        \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      6. unpow1/2N/A

                        \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      7. lower-sqrt.f6474.9

                        \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      8. lift-/.f64N/A

                        \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      9. div-invN/A

                        \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      10. lower-*.f64N/A

                        \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      11. metadata-eval74.9

                        \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                    4. Applied rewrites74.9%

                      \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                    5. Taylor expanded in angle around 0

                      \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
                    6. Step-by-step derivation
                      1. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
                    7. Applied rewrites68.1%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
                    8. Taylor expanded in a around 0

                      \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({angle}^{2} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                    9. Step-by-step derivation
                      1. Applied rewrites79.2%

                        \[\leadsto \left(\left(b \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                      2. Step-by-step derivation
                        1. Applied rewrites86.3%

                          \[\leadsto \left(\left(angle \cdot b\right) \cdot \left(angle \cdot b\right)\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \]
                      3. Recombined 2 regimes into one program.
                      4. Final simplification62.7%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle \cdot b\right) \cdot \left(angle \cdot b\right)\right)\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 13: 62.8% accurate, 12.1× speedup?

                      \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\\ \end{array} \end{array} \]
                      angle_m = (fabs.f64 angle)
                      (FPCore (a b angle_m)
                       :precision binary64
                       (if (<= b 1.75e+156)
                         (* a a)
                         (* (* angle_m b) (* angle_m (* b (* (PI) (* (PI) 3.08641975308642e-5)))))))
                      \begin{array}{l}
                      angle_m = \left|angle\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\
                      \;\;\;\;a \cdot a\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(angle\_m \cdot b\right) \cdot \left(angle\_m \cdot \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if b < 1.7500000000000002e156

                        1. Initial program 77.0%

                          \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                        2. Add Preprocessing
                        3. Taylor expanded in angle around 0

                          \[\leadsto \color{blue}{{a}^{2}} \]
                        4. Step-by-step derivation
                          1. unpow2N/A

                            \[\leadsto \color{blue}{a \cdot a} \]
                          2. lower-*.f6459.8

                            \[\leadsto \color{blue}{a \cdot a} \]
                        5. Applied rewrites59.8%

                          \[\leadsto \color{blue}{a \cdot a} \]

                        if 1.7500000000000002e156 < b

                        1. Initial program 99.9%

                          \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. unpow1N/A

                            \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          2. metadata-evalN/A

                            \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          3. pow-prod-upN/A

                            \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          4. pow2N/A

                            \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          5. lower-pow.f64N/A

                            \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          6. unpow1/2N/A

                            \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          7. lower-sqrt.f6474.9

                            \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          8. lift-/.f64N/A

                            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          9. div-invN/A

                            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          10. lower-*.f64N/A

                            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          11. metadata-eval74.9

                            \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                        4. Applied rewrites74.9%

                          \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                        5. Taylor expanded in angle around 0

                          \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
                        6. Step-by-step derivation
                          1. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
                        7. Applied rewrites68.1%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
                        8. Taylor expanded in a around 0

                          \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({angle}^{2} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                        9. Step-by-step derivation
                          1. Applied rewrites79.2%

                            \[\leadsto \left(\left(b \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                          2. Step-by-step derivation
                            1. Applied rewrites86.2%

                              \[\leadsto \left(angle \cdot b\right) \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)}\right) \]
                          3. Recombined 2 regimes into one program.
                          4. Add Preprocessing

                          Alternative 14: 61.3% accurate, 12.1× speedup?

                          \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{PI}\left(\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot \left(b \cdot \left(angle\_m \cdot angle\_m\right)\right)\right)\right)\\ \end{array} \end{array} \]
                          angle_m = (fabs.f64 angle)
                          (FPCore (a b angle_m)
                           :precision binary64
                           (if (<= b 1.75e+156)
                             (* a a)
                             (* (PI) (* (* (PI) 3.08641975308642e-5) (* b (* b (* angle_m angle_m)))))))
                          \begin{array}{l}
                          angle_m = \left|angle\right|
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;b \leq 1.75 \cdot 10^{+156}:\\
                          \;\;\;\;a \cdot a\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{PI}\left(\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot \left(b \cdot \left(angle\_m \cdot angle\_m\right)\right)\right)\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if b < 1.7500000000000002e156

                            1. Initial program 77.0%

                              \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                            2. Add Preprocessing
                            3. Taylor expanded in angle around 0

                              \[\leadsto \color{blue}{{a}^{2}} \]
                            4. Step-by-step derivation
                              1. unpow2N/A

                                \[\leadsto \color{blue}{a \cdot a} \]
                              2. lower-*.f6459.8

                                \[\leadsto \color{blue}{a \cdot a} \]
                            5. Applied rewrites59.8%

                              \[\leadsto \color{blue}{a \cdot a} \]

                            if 1.7500000000000002e156 < b

                            1. Initial program 99.9%

                              \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. unpow1N/A

                                \[\leadsto {\left(a \cdot \color{blue}{{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{1}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              2. metadata-evalN/A

                                \[\leadsto {\left(a \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\color{blue}{\left(\frac{1}{2} + \frac{1}{2}\right)}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              3. pow-prod-upN/A

                                \[\leadsto {\left(a \cdot \color{blue}{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}} \cdot {\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              4. pow2N/A

                                \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              5. lower-pow.f64N/A

                                \[\leadsto {\left(a \cdot \color{blue}{{\left({\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}^{\frac{1}{2}}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              6. unpow1/2N/A

                                \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              7. lower-sqrt.f6474.9

                                \[\leadsto {\left(a \cdot {\color{blue}{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              8. lift-/.f64N/A

                                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              9. div-invN/A

                                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              10. lower-*.f64N/A

                                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              11. metadata-eval74.9

                                \[\leadsto {\left(a \cdot {\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)}\right)}^{2}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                            4. Applied rewrites74.9%

                              \[\leadsto {\left(a \cdot \color{blue}{{\left(\sqrt{\cos \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2}}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                            5. Taylor expanded in angle around 0

                              \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
                            6. Step-by-step derivation
                              1. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
                            7. Applied rewrites68.1%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(a \cdot a, -3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a \cdot a\right)} \]
                            8. Taylor expanded in a around 0

                              \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({angle}^{2} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                            9. Step-by-step derivation
                              1. Applied rewrites79.2%

                                \[\leadsto \left(\left(b \cdot \left(angle \cdot angle\right)\right) \cdot b\right) \cdot \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                              2. Step-by-step derivation
                                1. Applied rewrites79.3%

                                  \[\leadsto \mathsf{PI}\left(\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot \left(angle \cdot angle\right)\right)\right)}\right) \]
                              3. Recombined 2 regimes into one program.
                              4. Add Preprocessing

                              Alternative 15: 56.6% accurate, 74.7× speedup?

                              \[\begin{array}{l} angle_m = \left|angle\right| \\ a \cdot a \end{array} \]
                              angle_m = (fabs.f64 angle)
                              (FPCore (a b angle_m) :precision binary64 (* a a))
                              angle_m = fabs(angle);
                              double code(double a, double b, double angle_m) {
                              	return a * a;
                              }
                              
                              angle_m = abs(angle)
                              real(8) function code(a, b, angle_m)
                                  real(8), intent (in) :: a
                                  real(8), intent (in) :: b
                                  real(8), intent (in) :: angle_m
                                  code = a * a
                              end function
                              
                              angle_m = Math.abs(angle);
                              public static double code(double a, double b, double angle_m) {
                              	return a * a;
                              }
                              
                              angle_m = math.fabs(angle)
                              def code(a, b, angle_m):
                              	return a * a
                              
                              angle_m = abs(angle)
                              function code(a, b, angle_m)
                              	return Float64(a * a)
                              end
                              
                              angle_m = abs(angle);
                              function tmp = code(a, b, angle_m)
                              	tmp = a * a;
                              end
                              
                              angle_m = N[Abs[angle], $MachinePrecision]
                              code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
                              
                              \begin{array}{l}
                              angle_m = \left|angle\right|
                              
                              \\
                              a \cdot a
                              \end{array}
                              
                              Derivation
                              1. Initial program 79.5%

                                \[{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
                              2. Add Preprocessing
                              3. Taylor expanded in angle around 0

                                \[\leadsto \color{blue}{{a}^{2}} \]
                              4. Step-by-step derivation
                                1. unpow2N/A

                                  \[\leadsto \color{blue}{a \cdot a} \]
                                2. lower-*.f6455.9

                                  \[\leadsto \color{blue}{a \cdot a} \]
                              5. Applied rewrites55.9%

                                \[\leadsto \color{blue}{a \cdot a} \]
                              6. Add Preprocessing

                              Reproduce

                              ?
                              herbie shell --seed 2024221 
                              (FPCore (a b angle)
                                :name "ab-angle->ABCF C"
                                :precision binary64
                                (+ (pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0) (pow (* b (sin (* (PI) (/ angle 180.0)))) 2.0)))