ab-angle->ABCF C

Percentage Accurate: 79.6% → 79.6%
Time: 10.2s
Alternatives: 11
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 79.6% accurate, 1.0× speedup?

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

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

Alternative 1: 79.6% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

Alternative 2: 79.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)}^{2} + a \cdot a \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+ (pow (* (sin (* (* 0.005555555555555556 angle) (PI))) b) 2.0) (* a a)))
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {\left(\sin \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right) \cdot b\right)}^{2} + a \cdot a \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+ (pow (* (sin (* (* 0.005555555555555556 (PI)) angle)) b) 2.0) (* a a)))
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right)}\right)}^{2} \]
  9. Final simplification80.7%

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

Alternative 4: 67.0% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\left(\mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.005555555555555556\right) \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right) \cdot b\right)}^{2} + a \cdot a\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= b 2.35e-63)
   (* a a)
   (+
    (pow
     (*
      (*
       (*
        (fma
         (* (* angle angle) -2.8577960676726107e-8)
         (* (PI) (PI))
         0.005555555555555556)
        (PI))
       angle)
      b)
     2.0)
    (* a a))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;{\left(\left(\left(\mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.005555555555555556\right) \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right) \cdot b\right)}^{2} + a \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.35e-63

    1. Initial program 77.8%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6462.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Applied rewrites62.1%

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

    if 2.35e-63 < b

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\color{blue}{\left(\left(\frac{1}{180} \cdot \mathsf{PI}\left(\right) + {angle}^{2} \cdot \left(\frac{-1}{34992000} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \cdot angle\right)} \cdot b\right)}^{2} + a \cdot a \]
    10. Applied rewrites83.0%

      \[\leadsto {\left(\color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(-2.8577960676726107 \cdot 10^{-8} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 0.005555555555555556\right)\right) \cdot angle\right)} \cdot b\right)}^{2} + a \cdot a \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.0%

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

Alternative 5: 67.0% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot {\left(b \cdot angle\right)}^{2}\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= b 2.35e-63)
   (* a a)
   (+
    (* (* 3.08641975308642e-5 (pow (* b angle) 2.0)) (* (PI) (PI)))
    (* a a))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot {\left(b \cdot angle\right)}^{2}\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.35e-63

    1. Initial program 77.8%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6462.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Applied rewrites62.1%

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

    if 2.35e-63 < b

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot \frac{1}{32400}\right) \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right) \]
      17. lower-PI.f6472.3

        \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot b\right) \cdot b\right) \]
    8. Applied rewrites72.3%

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

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

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

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

      Alternative 6: 67.0% accurate, 3.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot angle\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5} + a \cdot a\\ \end{array} \end{array} \]
      (FPCore (a b angle)
       :precision binary64
       (if (<= b 2.35e-63)
         (* a a)
         (+ (* (pow (* (* (PI) b) angle) 2.0) 3.08641975308642e-5) (* a a))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\
      \;\;\;\;a \cdot a\\
      
      \mathbf{else}:\\
      \;\;\;\;{\left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot angle\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5} + a \cdot a\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if b < 2.35e-63

        1. Initial program 77.8%

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

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

            \[\leadsto \color{blue}{a \cdot a} \]
          2. lower-*.f6462.1

            \[\leadsto \color{blue}{a \cdot a} \]
        5. Applied rewrites62.1%

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

        if 2.35e-63 < b

        1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot \frac{1}{32400}\right) \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right) \]
          17. lower-PI.f6472.3

            \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot b\right) \cdot b\right) \]
        8. Applied rewrites72.3%

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

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

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

              \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\frac{1}{32400} \cdot \left(angle \cdot angle\right)\right)\right) + a \cdot a} \]
            3. lower-+.f6473.4

              \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(b \cdot b\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right)\right) + a \cdot a} \]
          3. Applied rewrites83.3%

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

        Alternative 7: 67.0% accurate, 3.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} + a \cdot a\\ \end{array} \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (if (<= b 2.35e-63)
           (* a a)
           (+ (pow (* (* (* (PI) b) 0.005555555555555556) angle) 2.0) (* a a))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 2.35 \cdot 10^{-63}:\\
        \;\;\;\;a \cdot a\\
        
        \mathbf{else}:\\
        \;\;\;\;{\left(\left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} + a \cdot a\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 2.35e-63

          1. Initial program 77.8%

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

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

              \[\leadsto \color{blue}{a \cdot a} \]
            2. lower-*.f6462.1

              \[\leadsto \color{blue}{a \cdot a} \]
          5. Applied rewrites62.1%

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

          if 2.35e-63 < b

          1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto a \cdot a + {\left(\left(\left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot 0.005555555555555556\right) \cdot angle\right)}^{2} \]
          8. Applied rewrites83.2%

            \[\leadsto a \cdot a + {\color{blue}{\left(\left(\left(b \cdot \mathsf{PI}\left(\right)\right) \cdot 0.005555555555555556\right) \cdot angle\right)}}^{2} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification69.1%

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

        Alternative 8: 65.4% accurate, 10.4× speedup?

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

          1. Initial program 77.8%

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

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

              \[\leadsto \color{blue}{a \cdot a} \]
            2. lower-*.f6462.1

              \[\leadsto \color{blue}{a \cdot a} \]
          5. Applied rewrites62.1%

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

          if 2.35e-63 < b

          1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\left(\left(\left(angle \cdot angle\right) \cdot \frac{1}{32400}\right) \cdot b\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), b, a \cdot a\right) \]
            12. lower-PI.f6477.1

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

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

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

        Alternative 9: 70.4% accurate, 11.5× speedup?

        \[\begin{array}{l} \\ \left(\left(\left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (+
          (* (* (* (* (* b b) 3.08641975308642e-5) angle) angle) (* (PI) (PI)))
          (* a a)))
        \begin{array}{l}
        
        \\
        \left(\left(\left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a
        \end{array}
        
        Derivation
        1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot \frac{1}{32400}\right) \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right) \]
          17. lower-PI.f6467.8

            \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot b\right) \cdot b\right) \]
        8. Applied rewrites67.8%

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

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

              \[\leadsto a \cdot a + \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(\left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right) \cdot \color{blue}{angle}\right) \]
            2. Final simplification74.8%

              \[\leadsto \left(\left(\left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot angle\right) \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a \]
            3. Add Preprocessing

            Alternative 10: 70.4% accurate, 11.5× speedup?

            \[\begin{array}{l} \\ \left(\left(\left(b \cdot b\right) \cdot angle\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot angle\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a \end{array} \]
            (FPCore (a b angle)
             :precision binary64
             (+
              (* (* (* (* b b) angle) (* 3.08641975308642e-5 angle)) (* (PI) (PI)))
              (* a a)))
            \begin{array}{l}
            
            \\
            \left(\left(\left(b \cdot b\right) \cdot angle\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot angle\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a
            \end{array}
            
            Derivation
            1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot \frac{1}{32400}\right) \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right) \]
              17. lower-PI.f6467.8

                \[\leadsto a \cdot a + \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot b\right) \cdot b\right) \]
            8. Applied rewrites67.8%

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

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

                  \[\leadsto a \cdot a + \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(\left(3.08641975308642 \cdot 10^{-5} \cdot angle\right) \cdot \color{blue}{\left(angle \cdot \left(b \cdot b\right)\right)}\right) \]
                2. Final simplification74.8%

                  \[\leadsto \left(\left(\left(b \cdot b\right) \cdot angle\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot angle\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) + a \cdot a \]
                3. Add Preprocessing

                Alternative 11: 57.3% accurate, 74.7× speedup?

                \[\begin{array}{l} \\ a \cdot a \end{array} \]
                (FPCore (a b angle) :precision binary64 (* a a))
                double code(double a, double b, double angle) {
                	return a * a;
                }
                
                real(8) function code(a, b, angle)
                    real(8), intent (in) :: a
                    real(8), intent (in) :: b
                    real(8), intent (in) :: angle
                    code = a * a
                end function
                
                public static double code(double a, double b, double angle) {
                	return a * a;
                }
                
                def code(a, b, angle):
                	return a * a
                
                function code(a, b, angle)
                	return Float64(a * a)
                end
                
                function tmp = code(a, b, angle)
                	tmp = a * a;
                end
                
                code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                a \cdot a
                \end{array}
                
                Derivation
                1. Initial program 80.4%

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

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

                    \[\leadsto \color{blue}{a \cdot a} \]
                  2. lower-*.f6457.6

                    \[\leadsto \color{blue}{a \cdot a} \]
                5. Applied rewrites57.6%

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

                Reproduce

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