ab-angle->ABCF A

Percentage Accurate: 80.1% → 79.9%
Time: 14.7s
Alternatives: 14
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ {\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))))
double code(double a, double b, double angle) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
	double t_0 = (angle / 180.0) * Math.PI;
	return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle):
	t_0 = (angle / 180.0) * math.pi
	return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0))
end
function tmp = code(a, b, angle)
	t_0 = (angle / 180.0) * pi;
	tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\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 14 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: 80.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ {\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))))
double code(double a, double b, double angle) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
	double t_0 = (angle / 180.0) * Math.PI;
	return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle):
	t_0 = (angle / 180.0) * math.pi
	return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0))
end
function tmp = code(a, b, angle)
	t_0 = (angle / 180.0) * pi;
	tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

Alternative 1: 79.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + b \cdot b \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+ (pow (* a (sin (/ 1.0 (/ 180.0 (* angle PI))))) 2.0) (* b b)))
double code(double a, double b, double angle) {
	return pow((a * sin((1.0 / (180.0 / (angle * ((double) M_PI)))))), 2.0) + (b * b);
}
public static double code(double a, double b, double angle) {
	return Math.pow((a * Math.sin((1.0 / (180.0 / (angle * Math.PI))))), 2.0) + (b * b);
}
def code(a, b, angle):
	return math.pow((a * math.sin((1.0 / (180.0 / (angle * math.pi))))), 2.0) + (b * b)
function code(a, b, angle)
	return Float64((Float64(a * sin(Float64(1.0 / Float64(180.0 / Float64(angle * pi))))) ^ 2.0) + Float64(b * b))
end
function tmp = code(a, b, angle)
	tmp = ((a * sin((1.0 / (180.0 / (angle * pi))))) ^ 2.0) + (b * b);
end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(1.0 / N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
    3. associate-*l/N/A

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6485.9

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
      2. lower-*.f6486.0

        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
    4. Applied rewrites86.0%

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

    Alternative 2: 79.9% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ b \cdot b + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} \end{array} \]
    (FPCore (a b angle)
     :precision binary64
     (+ (* b b) (pow (* a (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
    double code(double a, double b, double angle) {
    	return (b * b) + pow((a * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
    }
    
    public static double code(double a, double b, double angle) {
    	return (b * b) + Math.pow((a * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
    }
    
    def code(a, b, angle):
    	return (b * b) + math.pow((a * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0)
    
    function code(a, b, angle)
    	return Float64(Float64(b * b) + (Float64(a * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0))
    end
    
    function tmp = code(a, b, angle)
    	tmp = (b * b) + ((a * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0);
    end
    
    code[a_, b_, angle_] := N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    b \cdot b + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
    \end{array}
    
    Derivation
    1. Initial program 85.8%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Add Preprocessing
    3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
      3. associate-*l/N/A

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

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

        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6485.9

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
        2. lower-*.f6486.0

          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
      4. Applied rewrites86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 79.9% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ b \cdot b + {\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \end{array} \]
      (FPCore (a b angle)
       :precision binary64
       (+ (* b b) (pow (* a (sin (* PI (* angle 0.005555555555555556)))) 2.0)))
      double code(double a, double b, double angle) {
      	return (b * b) + pow((a * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
      }
      
      public static double code(double a, double b, double angle) {
      	return (b * b) + Math.pow((a * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0);
      }
      
      def code(a, b, angle):
      	return (b * b) + math.pow((a * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0)
      
      function code(a, b, angle)
      	return Float64(Float64(b * b) + (Float64(a * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0))
      end
      
      function tmp = code(a, b, angle)
      	tmp = (b * b) + ((a * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0);
      end
      
      code[a_, b_, angle_] := N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      b \cdot b + {\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
      \end{array}
      
      Derivation
      1. Initial program 85.8%

        \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
      2. Add Preprocessing
      3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
        3. associate-*l/N/A

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

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

          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6485.9

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

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

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

          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
          2. lower-*.f6486.0

            \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
        4. Applied rewrites86.0%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}\right)}^{2} + b \cdot b \]
        7. Final simplification85.8%

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

        Alternative 4: 76.6% accurate, 2.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right), \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)}}\\ \end{array} \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (if (<= (/ angle 180.0) 4e-6)
           (+
            (* b b)
            (pow
             (*
              angle
              (*
               a
               (*
                PI
                (fma
                 (* (* angle angle) -2.8577960676726107e-8)
                 (* PI PI)
                 0.005555555555555556))))
             2.0))
           (/
            1.0
            (/
             1.0
             (fma
              (* a a)
              (- 0.5 (* 0.5 (cos (* 2.0 (* angle (* PI 0.005555555555555556))))))
              (* (* b b) (* 1.0 1.0)))))))
        double code(double a, double b, double angle) {
        	double tmp;
        	if ((angle / 180.0) <= 4e-6) {
        		tmp = (b * b) + pow((angle * (a * (((double) M_PI) * fma(((angle * angle) * -2.8577960676726107e-8), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), 2.0);
        	} else {
        		tmp = 1.0 / (1.0 / fma((a * a), (0.5 - (0.5 * cos((2.0 * (angle * (((double) M_PI) * 0.005555555555555556)))))), ((b * b) * (1.0 * 1.0))));
        	}
        	return tmp;
        }
        
        function code(a, b, angle)
        	tmp = 0.0
        	if (Float64(angle / 180.0) <= 4e-6)
        		tmp = Float64(Float64(b * b) + (Float64(angle * Float64(a * Float64(pi * fma(Float64(Float64(angle * angle) * -2.8577960676726107e-8), Float64(pi * pi), 0.005555555555555556)))) ^ 2.0));
        	else
        		tmp = Float64(1.0 / Float64(1.0 / fma(Float64(a * a), Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(angle * Float64(pi * 0.005555555555555556)))))), Float64(Float64(b * b) * Float64(1.0 * 1.0)))));
        	end
        	return tmp
        end
        
        code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-6], N[(N[(b * b), $MachinePrecision] + N[Power[N[(angle * N[(a * N[(Pi * N[(N[(N[(angle * angle), $MachinePrecision] * -2.8577960676726107e-8), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[(N[(a * a), $MachinePrecision] * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\
        \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right), \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)) < 3.99999999999999982e-6

          1. Initial program 89.3%

            \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
          2. Add Preprocessing
          3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
            3. associate-*l/N/A

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

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

              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6489.3

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

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

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

              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
              2. lower-*.f6489.4

                \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
            4. Applied rewrites89.4%

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

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

              \[\leadsto {\color{blue}{\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}}^{2} + b \cdot b \]

            if 3.99999999999999982e-6 < (/.f64 angle #s(literal 180 binary64))

            1. Initial program 74.3%

              \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
            2. Add Preprocessing
            3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
              3. associate-*l/N/A

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

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

                \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6474.4

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

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

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

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

                \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right), \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)}}} \]
            7. Recombined 2 regimes into one program.
            8. Final simplification83.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right), \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)}}\\ \end{array} \]
            9. Add Preprocessing

            Alternative 5: 76.6% accurate, 2.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1 \cdot \left(b \cdot 1\right), b, a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
            (FPCore (a b angle)
             :precision binary64
             (if (<= (/ angle 180.0) 4e-6)
               (+
                (* b b)
                (pow
                 (*
                  angle
                  (*
                   a
                   (*
                    PI
                    (fma
                     (* (* angle angle) -2.8577960676726107e-8)
                     (* PI PI)
                     0.005555555555555556))))
                 2.0))
               (fma
                (* 1.0 (* b 1.0))
                b
                (*
                 a
                 (*
                  a
                  (- 0.5 (* 0.5 (cos (* 2.0 (* angle (* PI 0.005555555555555556)))))))))))
            double code(double a, double b, double angle) {
            	double tmp;
            	if ((angle / 180.0) <= 4e-6) {
            		tmp = (b * b) + pow((angle * (a * (((double) M_PI) * fma(((angle * angle) * -2.8577960676726107e-8), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), 2.0);
            	} else {
            		tmp = fma((1.0 * (b * 1.0)), b, (a * (a * (0.5 - (0.5 * cos((2.0 * (angle * (((double) M_PI) * 0.005555555555555556)))))))));
            	}
            	return tmp;
            }
            
            function code(a, b, angle)
            	tmp = 0.0
            	if (Float64(angle / 180.0) <= 4e-6)
            		tmp = Float64(Float64(b * b) + (Float64(angle * Float64(a * Float64(pi * fma(Float64(Float64(angle * angle) * -2.8577960676726107e-8), Float64(pi * pi), 0.005555555555555556)))) ^ 2.0));
            	else
            		tmp = fma(Float64(1.0 * Float64(b * 1.0)), b, Float64(a * Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(angle * Float64(pi * 0.005555555555555556)))))))));
            	end
            	return tmp
            end
            
            code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-6], N[(N[(b * b), $MachinePrecision] + N[Power[N[(angle * N[(a * N[(Pi * N[(N[(N[(angle * angle), $MachinePrecision] * -2.8577960676726107e-8), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(b * 1.0), $MachinePrecision]), $MachinePrecision] * b + N[(a * N[(a * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\
            \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(1 \cdot \left(b \cdot 1\right), b, a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999982e-6

              1. Initial program 89.3%

                \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
              2. Add Preprocessing
              3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                3. associate-*l/N/A

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

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

                  \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6489.3

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

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

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

                  \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                  2. lower-*.f6489.4

                    \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                4. Applied rewrites89.4%

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

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

                  \[\leadsto {\color{blue}{\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}}^{2} + b \cdot b \]

                if 3.99999999999999982e-6 < (/.f64 angle #s(literal 180 binary64))

                1. Initial program 74.3%

                  \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                2. Add Preprocessing
                3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                  3. associate-*l/N/A

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

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

                    \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6474.4

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(b \cdot 1\right) \cdot 1, b, a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
                7. Recombined 2 regimes into one program.
                8. Final simplification83.3%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1 \cdot \left(b \cdot 1\right), b, a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\ \end{array} \]
                9. Add Preprocessing

                Alternative 6: 76.6% accurate, 2.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\ \end{array} \end{array} \]
                (FPCore (a b angle)
                 :precision binary64
                 (if (<= (/ angle 180.0) 4e-6)
                   (+
                    (* b b)
                    (pow
                     (*
                      angle
                      (*
                       a
                       (*
                        PI
                        (fma
                         (* (* angle angle) -2.8577960676726107e-8)
                         (* PI PI)
                         0.005555555555555556))))
                     2.0))
                   (fma
                    a
                    (* a (- 0.5 (* 0.5 (cos (* 2.0 (* (* angle PI) 0.005555555555555556))))))
                    (* b b))))
                double code(double a, double b, double angle) {
                	double tmp;
                	if ((angle / 180.0) <= 4e-6) {
                		tmp = (b * b) + pow((angle * (a * (((double) M_PI) * fma(((angle * angle) * -2.8577960676726107e-8), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), 2.0);
                	} else {
                		tmp = fma(a, (a * (0.5 - (0.5 * cos((2.0 * ((angle * ((double) M_PI)) * 0.005555555555555556)))))), (b * b));
                	}
                	return tmp;
                }
                
                function code(a, b, angle)
                	tmp = 0.0
                	if (Float64(angle / 180.0) <= 4e-6)
                		tmp = Float64(Float64(b * b) + (Float64(angle * Float64(a * Float64(pi * fma(Float64(Float64(angle * angle) * -2.8577960676726107e-8), Float64(pi * pi), 0.005555555555555556)))) ^ 2.0));
                	else
                		tmp = fma(a, Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(Float64(angle * pi) * 0.005555555555555556)))))), Float64(b * b));
                	end
                	return tmp
                end
                
                code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-6], N[(N[(b * b), $MachinePrecision] + N[Power[N[(angle * N[(a * N[(Pi * N[(N[(N[(angle * angle), $MachinePrecision] * -2.8577960676726107e-8), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(a * N[(a * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\
                \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999982e-6

                  1. Initial program 89.3%

                    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                  2. Add Preprocessing
                  3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                    3. associate-*l/N/A

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

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

                      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6489.3

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

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

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

                      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                      2. lower-*.f6489.4

                        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                    4. Applied rewrites89.4%

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

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

                      \[\leadsto {\color{blue}{\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}}^{2} + b \cdot b \]

                    if 3.99999999999999982e-6 < (/.f64 angle #s(literal 180 binary64))

                    1. Initial program 74.3%

                      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                    2. Add Preprocessing
                    3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                      3. associate-*l/N/A

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

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

                        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6474.4

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

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

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

                        \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                        2. lower-*.f6474.3

                          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                      4. Applied rewrites74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)} \]
                    7. Recombined 2 regimes into one program.
                    8. Final simplification83.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(a \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 7: 77.2% accurate, 2.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\ \end{array} \end{array} \]
                    (FPCore (a b angle)
                     :precision binary64
                     (if (<= (/ angle 180.0) 4e-6)
                       (+ (* b b) (pow (* (* angle PI) (* a 0.005555555555555556)) 2.0))
                       (fma
                        a
                        (* a (- 0.5 (* 0.5 (cos (* 2.0 (* (* angle PI) 0.005555555555555556))))))
                        (* b b))))
                    double code(double a, double b, double angle) {
                    	double tmp;
                    	if ((angle / 180.0) <= 4e-6) {
                    		tmp = (b * b) + pow(((angle * ((double) M_PI)) * (a * 0.005555555555555556)), 2.0);
                    	} else {
                    		tmp = fma(a, (a * (0.5 - (0.5 * cos((2.0 * ((angle * ((double) M_PI)) * 0.005555555555555556)))))), (b * b));
                    	}
                    	return tmp;
                    }
                    
                    function code(a, b, angle)
                    	tmp = 0.0
                    	if (Float64(angle / 180.0) <= 4e-6)
                    		tmp = Float64(Float64(b * b) + (Float64(Float64(angle * pi) * Float64(a * 0.005555555555555556)) ^ 2.0));
                    	else
                    		tmp = fma(a, Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(Float64(angle * pi) * 0.005555555555555556)))))), Float64(b * b));
                    	end
                    	return tmp
                    end
                    
                    code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-6], N[(N[(b * b), $MachinePrecision] + N[Power[N[(N[(angle * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(a * N[(a * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\
                    \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999982e-6

                      1. Initial program 89.3%

                        \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                      2. Add Preprocessing
                      3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                        3. associate-*l/N/A

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

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

                          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6489.3

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

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

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

                          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                          2. lower-*.f6489.4

                            \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                        4. Applied rewrites89.4%

                          \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                        5. 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} + b \cdot b \]
                        6. Step-by-step derivation
                          1. associate-*r*N/A

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

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

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

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

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

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

                          \[\leadsto {\color{blue}{\left(\left(angle \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot a\right)\right)}}^{2} + b \cdot b \]

                        if 3.99999999999999982e-6 < (/.f64 angle #s(literal 180 binary64))

                        1. Initial program 74.3%

                          \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                        2. Add Preprocessing
                        3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                          3. associate-*l/N/A

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

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

                            \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6474.4

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

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

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

                            \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                            2. lower-*.f6474.3

                              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                          4. Applied rewrites74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)} \]
                        7. Recombined 2 regimes into one program.
                        8. Final simplification83.9%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-6}:\\ \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\right), b \cdot b\right)\\ \end{array} \]
                        9. Add Preprocessing

                        Alternative 8: 67.5% accurate, 3.4× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 4.4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\ \end{array} \end{array} \]
                        (FPCore (a b angle)
                         :precision binary64
                         (if (<= a 4.4e-148)
                           (* b b)
                           (+ (* b b) (pow (* (* angle PI) (* a 0.005555555555555556)) 2.0))))
                        double code(double a, double b, double angle) {
                        	double tmp;
                        	if (a <= 4.4e-148) {
                        		tmp = b * b;
                        	} else {
                        		tmp = (b * b) + pow(((angle * ((double) M_PI)) * (a * 0.005555555555555556)), 2.0);
                        	}
                        	return tmp;
                        }
                        
                        public static double code(double a, double b, double angle) {
                        	double tmp;
                        	if (a <= 4.4e-148) {
                        		tmp = b * b;
                        	} else {
                        		tmp = (b * b) + Math.pow(((angle * Math.PI) * (a * 0.005555555555555556)), 2.0);
                        	}
                        	return tmp;
                        }
                        
                        def code(a, b, angle):
                        	tmp = 0
                        	if a <= 4.4e-148:
                        		tmp = b * b
                        	else:
                        		tmp = (b * b) + math.pow(((angle * math.pi) * (a * 0.005555555555555556)), 2.0)
                        	return tmp
                        
                        function code(a, b, angle)
                        	tmp = 0.0
                        	if (a <= 4.4e-148)
                        		tmp = Float64(b * b);
                        	else
                        		tmp = Float64(Float64(b * b) + (Float64(Float64(angle * pi) * Float64(a * 0.005555555555555556)) ^ 2.0));
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(a, b, angle)
                        	tmp = 0.0;
                        	if (a <= 4.4e-148)
                        		tmp = b * b;
                        	else
                        		tmp = (b * b) + (((angle * pi) * (a * 0.005555555555555556)) ^ 2.0);
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[a_, b_, angle_] := If[LessEqual[a, 4.4e-148], N[(b * b), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(N[(angle * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;a \leq 4.4 \cdot 10^{-148}:\\
                        \;\;\;\;b \cdot b\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if a < 4.40000000000000034e-148

                          1. Initial program 85.6%

                            \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6468.2

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

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

                          if 4.40000000000000034e-148 < a

                          1. Initial program 86.2%

                            \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
                          2. Add Preprocessing
                          3. 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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\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 \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
                            3. associate-*l/N/A

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

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

                              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\color{blue}{\frac{180}{angle \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. lower-*.f6486.2

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

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

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

                              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\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{1}{\frac{180}{angle \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{1}{\frac{180}{angle \cdot \mathsf{PI}\left(\right)}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                              2. lower-*.f6486.3

                                \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                            4. Applied rewrites86.3%

                              \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + \color{blue}{b \cdot b} \]
                            5. 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} + b \cdot b \]
                            6. Step-by-step derivation
                              1. associate-*r*N/A

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

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

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

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

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

                                \[\leadsto {\left(\left(angle \cdot \pi\right) \cdot \color{blue}{\left(0.005555555555555556 \cdot a\right)}\right)}^{2} + b \cdot b \]
                            7. Applied rewrites84.1%

                              \[\leadsto {\color{blue}{\left(\left(angle \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot a\right)\right)}}^{2} + b \cdot b \]
                          7. Recombined 2 regimes into one program.
                          8. Final simplification74.5%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 4.4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;b \cdot b + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\ \end{array} \]
                          9. Add Preprocessing

                          Alternative 9: 57.1% accurate, 4.9× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 7 \cdot 10^{-92}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), angle, b \cdot b\right)\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+141}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(angle, angle \cdot \left(\left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), \mathsf{fma}\left(\pi \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot \left(angle \cdot angle\right)\right)\right)\right), \frac{3.08641975308642 \cdot 10^{-5}}{b \cdot b}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                          (FPCore (a b angle)
                           :precision binary64
                           (if (<= b 7e-92)
                             (fma
                              (*
                               angle
                               (*
                                (* PI PI)
                                (fma a (* a 3.08641975308642e-5) (* (* b b) -3.08641975308642e-5))))
                              angle
                              (* b b))
                             (if (<= b 4e+141)
                               (*
                                (* b b)
                                (fma
                                 angle
                                 (* angle (* (* PI PI) -3.08641975308642e-5))
                                 (fma
                                  (* PI (* PI (* a (* a (* angle angle)))))
                                  (/ 3.08641975308642e-5 (* b b))
                                  1.0)))
                               (* b b))))
                          double code(double a, double b, double angle) {
                          	double tmp;
                          	if (b <= 7e-92) {
                          		tmp = fma((angle * ((((double) M_PI) * ((double) M_PI)) * fma(a, (a * 3.08641975308642e-5), ((b * b) * -3.08641975308642e-5)))), angle, (b * b));
                          	} else if (b <= 4e+141) {
                          		tmp = (b * b) * fma(angle, (angle * ((((double) M_PI) * ((double) M_PI)) * -3.08641975308642e-5)), fma((((double) M_PI) * (((double) M_PI) * (a * (a * (angle * angle))))), (3.08641975308642e-5 / (b * b)), 1.0));
                          	} else {
                          		tmp = b * b;
                          	}
                          	return tmp;
                          }
                          
                          function code(a, b, angle)
                          	tmp = 0.0
                          	if (b <= 7e-92)
                          		tmp = fma(Float64(angle * Float64(Float64(pi * pi) * fma(a, Float64(a * 3.08641975308642e-5), Float64(Float64(b * b) * -3.08641975308642e-5)))), angle, Float64(b * b));
                          	elseif (b <= 4e+141)
                          		tmp = Float64(Float64(b * b) * fma(angle, Float64(angle * Float64(Float64(pi * pi) * -3.08641975308642e-5)), fma(Float64(pi * Float64(pi * Float64(a * Float64(a * Float64(angle * angle))))), Float64(3.08641975308642e-5 / Float64(b * b)), 1.0)));
                          	else
                          		tmp = Float64(b * b);
                          	end
                          	return tmp
                          end
                          
                          code[a_, b_, angle_] := If[LessEqual[b, 7e-92], N[(N[(angle * N[(N[(Pi * Pi), $MachinePrecision] * N[(a * N[(a * 3.08641975308642e-5), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(b * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e+141], N[(N[(b * b), $MachinePrecision] * N[(angle * N[(angle * N[(N[(Pi * Pi), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] + N[(N[(Pi * N[(Pi * N[(a * N[(a * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(3.08641975308642e-5 / N[(b * b), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;b \leq 7 \cdot 10^{-92}:\\
                          \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), angle, b \cdot b\right)\\
                          
                          \mathbf{elif}\;b \leq 4 \cdot 10^{+141}:\\
                          \;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(angle, angle \cdot \left(\left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), \mathsf{fma}\left(\pi \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot \left(angle \cdot angle\right)\right)\right)\right), \frac{3.08641975308642 \cdot 10^{-5}}{b \cdot b}, 1\right)\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;b \cdot b\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if b < 7e-92

                            1. Initial program 84.6%

                              \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites38.7%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites43.7%

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

                              if 7e-92 < b < 4.00000000000000007e141

                              1. Initial program 79.3%

                                \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites62.5%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites16.0%

                                  \[\leadsto \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right) \cdot \color{blue}{\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                                2. Taylor expanded in b around inf

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

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

                                  if 4.00000000000000007e141 < b

                                  1. Initial program 98.2%

                                    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6498.1

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

                                    \[\leadsto \color{blue}{b \cdot b} \]
                                4. Recombined 3 regimes into one program.
                                5. Final simplification57.7%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7 \cdot 10^{-92}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), angle, b \cdot b\right)\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+141}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(angle, angle \cdot \left(\left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), \mathsf{fma}\left(\pi \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot \left(angle \cdot angle\right)\right)\right)\right), \frac{3.08641975308642 \cdot 10^{-5}}{b \cdot b}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \]
                                6. Add Preprocessing

                                Alternative 10: 56.6% accurate, 5.6× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\\ \mathbf{if}\;b \leq 4 \cdot 10^{-94}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, t\_0\right)\right), angle, b \cdot b\right)\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{+91}:\\ \;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), angle, \mathsf{fma}\left(a, \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(angle \cdot \pi\right)\right), b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                                (FPCore (a b angle)
                                 :precision binary64
                                 (let* ((t_0 (* (* b b) -3.08641975308642e-5)))
                                   (if (<= b 4e-94)
                                     (fma
                                      (* angle (* (* PI PI) (fma a (* a 3.08641975308642e-5) t_0)))
                                      angle
                                      (* b b))
                                     (if (<= b 7.5e+91)
                                       (fma
                                        (* t_0 (* angle (* PI PI)))
                                        angle
                                        (fma
                                         a
                                         (* (* a 3.08641975308642e-5) (* (* angle PI) (* angle PI)))
                                         (* b b)))
                                       (* b b)))))
                                double code(double a, double b, double angle) {
                                	double t_0 = (b * b) * -3.08641975308642e-5;
                                	double tmp;
                                	if (b <= 4e-94) {
                                		tmp = fma((angle * ((((double) M_PI) * ((double) M_PI)) * fma(a, (a * 3.08641975308642e-5), t_0))), angle, (b * b));
                                	} else if (b <= 7.5e+91) {
                                		tmp = fma((t_0 * (angle * (((double) M_PI) * ((double) M_PI)))), angle, fma(a, ((a * 3.08641975308642e-5) * ((angle * ((double) M_PI)) * (angle * ((double) M_PI)))), (b * b)));
                                	} else {
                                		tmp = b * b;
                                	}
                                	return tmp;
                                }
                                
                                function code(a, b, angle)
                                	t_0 = Float64(Float64(b * b) * -3.08641975308642e-5)
                                	tmp = 0.0
                                	if (b <= 4e-94)
                                		tmp = fma(Float64(angle * Float64(Float64(pi * pi) * fma(a, Float64(a * 3.08641975308642e-5), t_0))), angle, Float64(b * b));
                                	elseif (b <= 7.5e+91)
                                		tmp = fma(Float64(t_0 * Float64(angle * Float64(pi * pi))), angle, fma(a, Float64(Float64(a * 3.08641975308642e-5) * Float64(Float64(angle * pi) * Float64(angle * pi))), Float64(b * b)));
                                	else
                                		tmp = Float64(b * b);
                                	end
                                	return tmp
                                end
                                
                                code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]}, If[LessEqual[b, 4e-94], N[(N[(angle * N[(N[(Pi * Pi), $MachinePrecision] * N[(a * N[(a * 3.08641975308642e-5), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(b * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.5e+91], N[(N[(t$95$0 * N[(angle * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(a * N[(N[(a * 3.08641975308642e-5), $MachinePrecision] * N[(N[(angle * Pi), $MachinePrecision] * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\\
                                \mathbf{if}\;b \leq 4 \cdot 10^{-94}:\\
                                \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, t\_0\right)\right), angle, b \cdot b\right)\\
                                
                                \mathbf{elif}\;b \leq 7.5 \cdot 10^{+91}:\\
                                \;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), angle, \mathsf{fma}\left(a, \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(angle \cdot \pi\right)\right), b \cdot b\right)\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;b \cdot b\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if b < 3.9999999999999998e-94

                                  1. Initial program 84.6%

                                    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites38.7%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites43.7%

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

                                    if 3.9999999999999998e-94 < b < 7.50000000000000033e91

                                    1. Initial program 85.9%

                                      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites74.9%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites80.4%

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

                                      if 7.50000000000000033e91 < b

                                      1. Initial program 89.7%

                                        \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6486.1

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

                                        \[\leadsto \color{blue}{b \cdot b} \]
                                    7. Recombined 3 regimes into one program.
                                    8. Add Preprocessing

                                    Alternative 11: 55.5% accurate, 8.3× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1250000000000:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), angle, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                                    (FPCore (a b angle)
                                     :precision binary64
                                     (if (<= b 1250000000000.0)
                                       (fma
                                        (*
                                         angle
                                         (*
                                          (* PI PI)
                                          (fma a (* a 3.08641975308642e-5) (* (* b b) -3.08641975308642e-5))))
                                        angle
                                        (* b b))
                                       (* b b)))
                                    double code(double a, double b, double angle) {
                                    	double tmp;
                                    	if (b <= 1250000000000.0) {
                                    		tmp = fma((angle * ((((double) M_PI) * ((double) M_PI)) * fma(a, (a * 3.08641975308642e-5), ((b * b) * -3.08641975308642e-5)))), angle, (b * b));
                                    	} else {
                                    		tmp = b * b;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(a, b, angle)
                                    	tmp = 0.0
                                    	if (b <= 1250000000000.0)
                                    		tmp = fma(Float64(angle * Float64(Float64(pi * pi) * fma(a, Float64(a * 3.08641975308642e-5), Float64(Float64(b * b) * -3.08641975308642e-5)))), angle, Float64(b * b));
                                    	else
                                    		tmp = Float64(b * b);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[a_, b_, angle_] := If[LessEqual[b, 1250000000000.0], N[(N[(angle * N[(N[(Pi * Pi), $MachinePrecision] * N[(a * N[(a * 3.08641975308642e-5), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;b \leq 1250000000000:\\
                                    \;\;\;\;\mathsf{fma}\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a, a \cdot 3.08641975308642 \cdot 10^{-5}, \left(b \cdot b\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), angle, b \cdot b\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;b \cdot b\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if b < 1.25e12

                                      1. Initial program 85.3%

                                        \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites42.4%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites47.0%

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

                                        if 1.25e12 < b

                                        1. Initial program 87.2%

                                          \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6480.9

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

                                          \[\leadsto \color{blue}{b \cdot b} \]
                                      7. Recombined 2 regimes into one program.
                                      8. Add Preprocessing

                                      Alternative 12: 52.4% accurate, 9.1× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 3.1 \cdot 10^{-145}:\\ \;\;\;\;angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+87}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                                      (FPCore (a b angle)
                                       :precision binary64
                                       (if (<= b 3.1e-145)
                                         (* angle (* (* angle 3.08641975308642e-5) (* PI (* PI (* a a)))))
                                         (if (<= b 4e+87)
                                           (fma
                                            (* angle (* angle (* PI PI)))
                                            (* (* a a) 3.08641975308642e-5)
                                            (* b b))
                                           (* b b))))
                                      double code(double a, double b, double angle) {
                                      	double tmp;
                                      	if (b <= 3.1e-145) {
                                      		tmp = angle * ((angle * 3.08641975308642e-5) * (((double) M_PI) * (((double) M_PI) * (a * a))));
                                      	} else if (b <= 4e+87) {
                                      		tmp = fma((angle * (angle * (((double) M_PI) * ((double) M_PI)))), ((a * a) * 3.08641975308642e-5), (b * b));
                                      	} else {
                                      		tmp = b * b;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(a, b, angle)
                                      	tmp = 0.0
                                      	if (b <= 3.1e-145)
                                      		tmp = Float64(angle * Float64(Float64(angle * 3.08641975308642e-5) * Float64(pi * Float64(pi * Float64(a * a)))));
                                      	elseif (b <= 4e+87)
                                      		tmp = fma(Float64(angle * Float64(angle * Float64(pi * pi))), Float64(Float64(a * a) * 3.08641975308642e-5), Float64(b * b));
                                      	else
                                      		tmp = Float64(b * b);
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[a_, b_, angle_] := If[LessEqual[b, 3.1e-145], N[(angle * N[(N[(angle * 3.08641975308642e-5), $MachinePrecision] * N[(Pi * N[(Pi * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e+87], N[(N[(angle * N[(angle * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;b \leq 3.1 \cdot 10^{-145}:\\
                                      \;\;\;\;angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)\right)\\
                                      
                                      \mathbf{elif}\;b \leq 4 \cdot 10^{+87}:\\
                                      \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}, b \cdot b\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;b \cdot b\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if b < 3.1e-145

                                        1. Initial program 86.1%

                                          \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites38.8%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites36.5%

                                            \[\leadsto \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right) \cdot \color{blue}{\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites43.7%

                                              \[\leadsto angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \color{blue}{\left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)}\right) \]

                                            if 3.1e-145 < b < 3.9999999999999998e87

                                            1. Initial program 79.3%

                                              \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites68.5%

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites69.3%

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

                                              if 3.9999999999999998e87 < b

                                              1. Initial program 89.9%

                                                \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6486.3

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

                                                \[\leadsto \color{blue}{b \cdot b} \]
                                            8. Recombined 3 regimes into one program.
                                            9. Add Preprocessing

                                            Alternative 13: 49.9% accurate, 12.1× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.35 \cdot 10^{-137}:\\ \;\;\;\;angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                                            (FPCore (a b angle)
                                             :precision binary64
                                             (if (<= b 1.35e-137)
                                               (* angle (* (* angle 3.08641975308642e-5) (* PI (* PI (* a a)))))
                                               (* b b)))
                                            double code(double a, double b, double angle) {
                                            	double tmp;
                                            	if (b <= 1.35e-137) {
                                            		tmp = angle * ((angle * 3.08641975308642e-5) * (((double) M_PI) * (((double) M_PI) * (a * a))));
                                            	} else {
                                            		tmp = b * b;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            public static double code(double a, double b, double angle) {
                                            	double tmp;
                                            	if (b <= 1.35e-137) {
                                            		tmp = angle * ((angle * 3.08641975308642e-5) * (Math.PI * (Math.PI * (a * a))));
                                            	} else {
                                            		tmp = b * b;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(a, b, angle):
                                            	tmp = 0
                                            	if b <= 1.35e-137:
                                            		tmp = angle * ((angle * 3.08641975308642e-5) * (math.pi * (math.pi * (a * a))))
                                            	else:
                                            		tmp = b * b
                                            	return tmp
                                            
                                            function code(a, b, angle)
                                            	tmp = 0.0
                                            	if (b <= 1.35e-137)
                                            		tmp = Float64(angle * Float64(Float64(angle * 3.08641975308642e-5) * Float64(pi * Float64(pi * Float64(a * a)))));
                                            	else
                                            		tmp = Float64(b * b);
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(a, b, angle)
                                            	tmp = 0.0;
                                            	if (b <= 1.35e-137)
                                            		tmp = angle * ((angle * 3.08641975308642e-5) * (pi * (pi * (a * a))));
                                            	else
                                            		tmp = b * b;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[a_, b_, angle_] := If[LessEqual[b, 1.35e-137], N[(angle * N[(N[(angle * 3.08641975308642e-5), $MachinePrecision] * N[(Pi * N[(Pi * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            \mathbf{if}\;b \leq 1.35 \cdot 10^{-137}:\\
                                            \;\;\;\;angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)\right)\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;b \cdot b\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if b < 1.34999999999999996e-137

                                              1. Initial program 86.1%

                                                \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 rewrites38.8%

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\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 rewrites36.5%

                                                  \[\leadsto \left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right) \cdot \color{blue}{\left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites43.7%

                                                    \[\leadsto angle \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \color{blue}{\left(\pi \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)}\right) \]

                                                  if 1.34999999999999996e-137 < b

                                                  1. Initial program 85.4%

                                                    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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-*.f6474.9

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

                                                    \[\leadsto \color{blue}{b \cdot b} \]
                                                3. Recombined 2 regimes into one program.
                                                4. Add Preprocessing

                                                Alternative 14: 57.4% accurate, 74.7× speedup?

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

                                                  \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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.2

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

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

                                                Reproduce

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