ab-angle->ABCF A

Percentage Accurate: 79.5% → 79.5%
Time: 17.2s
Alternatives: 12
Speedup: 2.5×

Specification

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

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos 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 12 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 79.5% accurate, 2.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\


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

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot a\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \sqrt{\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}}\right)\right)}^{2} \]
      7. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000024e-5 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification75.2%

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

    Alternative 2: 79.4% accurate, 0.6× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \sqrt[3]{\mathsf{PI}\left(\right)}\\ {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(t\_0 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} \end{array} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (let* ((t_0 (cbrt (PI))))
       (+
        (pow (* a (sin (* (/ angle_m 180.0) (PI)))) 2.0)
        (pow
         (* b (cos (* t_0 (* t_0 (* t_0 (* angle_m 0.005555555555555556))))))
         2.0))))
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    \begin{array}{l}
    t_0 := \sqrt[3]{\mathsf{PI}\left(\right)}\\
    {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(t\_0 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 79.5% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 79.5% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

        Alternative 5: 72.5% accurate, 2.5× speedup?

        \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\ \end{array} \end{array} \]
        angle_m = (fabs.f64 angle)
        (FPCore (a b angle_m)
         :precision binary64
         (if (<= (/ angle_m 180.0) 4e-148)
           (* b b)
           (if (<= (/ angle_m 180.0) 3e-25)
             (fma
              (* angle_m (* angle_m (* (PI) (PI))))
              (* 3.08641975308642e-5 (* a a))
              (* b b))
             (fma
              (* a (fma (cos (* angle_m (* (PI) 0.011111111111111112))) -0.5 0.5))
              a
              (* (* b b) (* 1.0 1.0))))))
        \begin{array}{l}
        angle_m = \left|angle\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
        \;\;\;\;b \cdot b\\
        
        \mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{-25}:\\
        \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148

          1. Initial program 84.5%

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

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

              \[\leadsto \color{blue}{b \cdot b} \]
            2. lower-*.f6467.3

              \[\leadsto \color{blue}{b \cdot b} \]
          5. Applied rewrites67.3%

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

          if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 2.9999999999999998e-25

          1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
            9. distribute-rgt-outN/A

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

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

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

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

            if 2.9999999999999998e-25 < (/.f64 angle #s(literal 180 binary64))

            1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification68.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle}{180} \leq 3 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\ \end{array} \]
            7. Add Preprocessing

            Alternative 6: 73.2% accurate, 2.6× speedup?

            \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot 0.5, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \mathsf{PI}\left(\right)\right)\right), -0.5, 0.5\right)\right)\\ \end{array} \end{array} \]
            angle_m = (fabs.f64 angle)
            (FPCore (a b angle_m)
             :precision binary64
             (if (<= (/ angle_m 180.0) 4e-148)
               (* b b)
               (if (<= (/ angle_m 180.0) 5e-5)
                 (fma
                  (* angle_m (* angle_m (* (PI) (PI))))
                  (* 3.08641975308642e-5 (* a a))
                  (* b b))
                 (fma
                  (* b 0.5)
                  b
                  (*
                   (* a a)
                   (fma (cos (* 0.011111111111111112 (* angle_m (PI)))) -0.5 0.5))))))
            \begin{array}{l}
            angle_m = \left|angle\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
            \;\;\;\;b \cdot b\\
            
            \mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{-5}:\\
            \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(b \cdot 0.5, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \mathsf{PI}\left(\right)\right)\right), -0.5, 0.5\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148

              1. Initial program 84.5%

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

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

                  \[\leadsto \color{blue}{b \cdot b} \]
                2. lower-*.f6467.3

                  \[\leadsto \color{blue}{b \cdot b} \]
              5. Applied rewrites67.3%

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

              if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 5.00000000000000024e-5

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                9. distribute-rgt-outN/A

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

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

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

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

                if 5.00000000000000024e-5 < (/.f64 angle #s(literal 180 binary64))

                1. Initial program 58.2%

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

                  \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \mathsf{PI}\left(\right)\right)\right), \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)}}} \]
                4. Applied rewrites41.2%

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

                  \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \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)}\right) \]
                6. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \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)}\right) \]
                  2. unpow2N/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \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)\right) \]
                  3. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \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)\right) \]
                  4. +-commutativeN/A

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(0.5 \cdot b, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right)\right) \]
                7. Applied rewrites58.7%

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

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

              Alternative 7: 59.8% accurate, 3.4× speedup?

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

                1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                  9. distribute-rgt-outN/A

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

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

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

                  if 2.1000000000000002e63 < b

                  1. Initial program 91.7%

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

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

                    \[\leadsto \color{blue}{{b}^{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}{{b}^{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(b \cdot b\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(b \cdot b\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(b \cdot b\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(b \cdot b\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(b \cdot b\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(b \cdot b\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{90}\right)}, \frac{1}{2}\right) \]
                    8. lower-*.f64N/A

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

                      \[\leadsto \left(b \cdot b\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{90}\right), \frac{1}{2}\right) \]
                    10. lower-PI.f6491.9

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

                    \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.011111111111111112\right), 0.5\right)} \]
                7. Recombined 2 regimes into one program.
                8. Final simplification61.0%

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

                Alternative 8: 66.4% accurate, 4.5× speedup?

                \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\\ \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\ \end{array} \end{array} \]
                angle_m = (fabs.f64 angle)
                (FPCore (a b angle_m)
                 :precision binary64
                 (let* ((t_0 (* angle_m (* angle_m (* (PI) (PI))))))
                   (if (<= (/ angle_m 180.0) 4e-148)
                     (* b b)
                     (if (<= (/ angle_m 180.0) 7.5e+161)
                       (fma t_0 (* 3.08641975308642e-5 (* a a)) (* b b))
                       (if (<= (/ angle_m 180.0) 2e+286)
                         (* b b)
                         (fma
                          t_0
                          (fma (* a 3.08641975308642e-5) a (* b (* b -3.08641975308642e-5)))
                          (* b b)))))))
                \begin{array}{l}
                angle_m = \left|angle\right|
                
                \\
                \begin{array}{l}
                t_0 := angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\\
                \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
                \;\;\;\;b \cdot b\\
                
                \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\
                \;\;\;\;\mathsf{fma}\left(t\_0, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
                
                \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\
                \;\;\;\;b \cdot b\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148 or 7.4999999999999995e161 < (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000007e286

                  1. Initial program 78.6%

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

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

                      \[\leadsto \color{blue}{b \cdot b} \]
                    2. lower-*.f6464.0

                      \[\leadsto \color{blue}{b \cdot b} \]
                  5. Applied rewrites64.0%

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

                  if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 7.4999999999999995e161

                  1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                    9. distribute-rgt-outN/A

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

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

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

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

                    if 2.00000000000000007e286 < (/.f64 angle #s(literal 180 binary64))

                    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                      9. distribute-rgt-outN/A

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 9: 67.0% accurate, 5.1× speedup?

                    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    angle_m = (fabs.f64 angle)
                    (FPCore (a b angle_m)
                     :precision binary64
                     (let* ((t_0
                             (fma
                              (* angle_m (* angle_m (* (PI) (PI))))
                              (* 3.08641975308642e-5 (* a a))
                              (* b b))))
                       (if (<= (/ angle_m 180.0) 4e-148)
                         (* b b)
                         (if (<= (/ angle_m 180.0) 7.5e+161)
                           t_0
                           (if (<= (/ angle_m 180.0) 2e+286) (* b b) t_0)))))
                    \begin{array}{l}
                    angle_m = \left|angle\right|
                    
                    \\
                    \begin{array}{l}
                    t_0 := \mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
                    \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
                    \;\;\;\;b \cdot b\\
                    
                    \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\
                    \;\;\;\;b \cdot b\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148 or 7.4999999999999995e161 < (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000007e286

                      1. Initial program 78.6%

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

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

                          \[\leadsto \color{blue}{b \cdot b} \]
                        2. lower-*.f6464.0

                          \[\leadsto \color{blue}{b \cdot b} \]
                      5. Applied rewrites64.0%

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

                      if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 7.4999999999999995e161 or 2.00000000000000007e286 < (/.f64 angle #s(literal 180 binary64))

                      1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                        9. distribute-rgt-outN/A

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

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

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

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \end{array} \]
                      10. Add Preprocessing

                      Alternative 10: 59.9% accurate, 8.3× speedup?

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

                        1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                          9. distribute-rgt-outN/A

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

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

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

                          if 2.1000000000000002e63 < b

                          1. Initial program 91.7%

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6492.0

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites92.0%

                            \[\leadsto \color{blue}{b \cdot b} \]
                        7. Recombined 2 regimes into one program.
                        8. Final simplification61.0%

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

                        Alternative 11: 61.1% accurate, 12.1× speedup?

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

                          1. Initial program 76.8%

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6463.5

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites63.5%

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

                          if 9.00000000000000016e147 < a

                          1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

                              \[\leadsto \left(\left(\frac{1}{32400} \cdot {a}^{2}\right) \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{-1}{32400} \cdot {b}^{2}\right) \cdot \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right) + {b}^{2} \]
                            9. distribute-rgt-outN/A

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

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

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

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

                          Alternative 12: 56.7% accurate, 74.7× speedup?

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

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6460.3

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites60.3%

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

                          Reproduce

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