ab-angle->ABCF C

Percentage Accurate: 80.5% → 80.4%
Time: 12.3s
Alternatives: 8
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 80.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a, a, {\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\right) \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (fma a a (pow (* b (sin (* angle (* 0.005555555555555556 PI)))) 2.0)))
double code(double a, double b, double angle) {
	return fma(a, a, pow((b * sin((angle * (0.005555555555555556 * ((double) M_PI))))), 2.0));
}
function code(a, b, angle)
	return fma(a, a, (Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi)))) ^ 2.0))
end
code[a_, b_, angle_] := N[(a * a + N[Power[N[(b * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(a, a, {\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 80.5%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Step-by-step derivation
    1. Simplified80.5%

      \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0 80.6%

      \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    4. Step-by-step derivation
      1. unpow280.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, a, {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\right)} \]
      3. add-sqr-sqrt80.6%

        \[\leadsto \mathsf{fma}\left(a, a, \color{blue}{\sqrt{{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \cdot \sqrt{{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}}}\right) \]
      4. pow280.6%

        \[\leadsto \mathsf{fma}\left(a, a, \color{blue}{{\left(\sqrt{{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}}\right)}^{2}}\right) \]
      5. sqrt-pow180.6%

        \[\leadsto \mathsf{fma}\left(a, a, {\color{blue}{\left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{\left(\frac{2}{2}\right)}\right)}}^{2}\right) \]
      6. metadata-eval80.6%

        \[\leadsto \mathsf{fma}\left(a, a, {\left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{\color{blue}{1}}\right)}^{2}\right) \]
      7. pow180.6%

        \[\leadsto \mathsf{fma}\left(a, a, {\color{blue}{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}}^{2}\right) \]
      8. *-commutative80.6%

        \[\leadsto \mathsf{fma}\left(a, a, {\left(b \cdot \sin \color{blue}{\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}\right)}^{2}\right) \]
      9. associate-*r*80.6%

        \[\leadsto \mathsf{fma}\left(a, a, {\left(b \cdot \sin \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}\right)}^{2}\right) \]
    5. Applied egg-rr80.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, a, {\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\right)} \]
    6. Add Preprocessing

    Alternative 2: 59.5% accurate, 2.0× speedup?

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

      1. Initial program 80.7%

        \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      2. Step-by-step derivation
        1. Simplified80.7%

          \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
        2. Add Preprocessing
        3. Taylor expanded in angle around 0 80.8%

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

          \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} \]
        5. Step-by-step derivation
          1. unpow244.7%

            \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \]
          2. *-commutative44.7%

            \[\leadsto \left(b \cdot b\right) \cdot {\sin \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)}^{2} \]
          3. associate-*l*44.7%

            \[\leadsto \left(b \cdot b\right) \cdot {\sin \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}}^{2} \]
          4. *-commutative44.7%

            \[\leadsto \left(b \cdot b\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}}^{2} \]
          5. unpow244.7%

            \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
          6. swap-sqr51.0%

            \[\leadsto \color{blue}{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right) \cdot \left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
          7. unpow251.0%

            \[\leadsto \color{blue}{{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}} \]
          8. *-commutative51.0%

            \[\leadsto {\left(b \cdot \sin \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}\right)}^{2} \]
          9. associate-*l*51.0%

            \[\leadsto {\left(b \cdot \sin \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)}^{2} \]
          10. *-commutative51.0%

            \[\leadsto {\left(b \cdot \sin \left(0.005555555555555556 \cdot \color{blue}{\left(angle \cdot \pi\right)}\right)\right)}^{2} \]
        6. Simplified51.0%

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

        if 2.80000000000000016e-160 < a

        1. Initial program 80.1%

          \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
        2. Step-by-step derivation
          1. Simplified80.2%

            \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
          2. Add Preprocessing
          3. Taylor expanded in angle around 0 80.3%

            \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
          4. Step-by-step derivation
            1. unpow280.3%

              \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
          5. Applied egg-rr80.3%

            \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
          6. Taylor expanded in angle around 0 77.9%

            \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
          7. Step-by-step derivation
            1. associate-*r*77.9%

              \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)}\right)}^{2} \]
            2. *-commutative77.9%

              \[\leadsto a \cdot a + {\left(b \cdot \left(\color{blue}{\left(angle \cdot 0.005555555555555556\right)} \cdot \pi\right)\right)}^{2} \]
            3. associate-*r*77.9%

              \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}\right)}^{2} \]
            4. *-commutative77.9%

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

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

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

        Alternative 3: 67.3% accurate, 2.0× speedup?

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

          1. Initial program 80.8%

            \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
          2. Step-by-step derivation
            1. Simplified80.8%

              \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around inf 59.8%

              \[\leadsto \color{blue}{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} \]
            4. Step-by-step derivation
              1. *-commutative59.8%

                \[\leadsto \color{blue}{{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {a}^{2}} \]
              2. associate-*r*59.9%

                \[\leadsto {\cos \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)}}^{2} \cdot {a}^{2} \]
              3. *-commutative59.9%

                \[\leadsto {\cos \left(\color{blue}{\left(angle \cdot 0.005555555555555556\right)} \cdot \pi\right)}^{2} \cdot {a}^{2} \]
              4. associate-*r*59.9%

                \[\leadsto {\cos \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}}^{2} \cdot {a}^{2} \]
              5. unpow259.9%

                \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \cdot {a}^{2} \]
              6. unpow259.9%

                \[\leadsto \left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right) \cdot \color{blue}{\left(a \cdot a\right)} \]
              7. swap-sqr59.9%

                \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right) \cdot \left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right)} \]
              8. unpow259.9%

                \[\leadsto \color{blue}{{\left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right)}^{2}} \]
            5. Simplified59.9%

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

            if 1.2000000000000001e-90 < b

            1. Initial program 79.9%

              \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
            2. Step-by-step derivation
              1. Simplified79.9%

                \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
              2. Add Preprocessing
              3. Taylor expanded in angle around 0 80.9%

                \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
              4. Step-by-step derivation
                1. unpow280.9%

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

                \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
              6. Taylor expanded in angle around 0 78.2%

                \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
              7. Step-by-step derivation
                1. associate-*r*78.2%

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

                  \[\leadsto a \cdot a + {\left(b \cdot \left(\color{blue}{\left(angle \cdot 0.005555555555555556\right)} \cdot \pi\right)\right)}^{2} \]
                3. associate-*r*78.2%

                  \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}\right)}^{2} \]
                4. *-commutative78.2%

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

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

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

            Alternative 4: 80.4% accurate, 2.0× speedup?

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

              \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
            2. Step-by-step derivation
              1. Simplified80.5%

                \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
              2. Add Preprocessing
              3. Taylor expanded in angle around 0 80.6%

                \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
              4. Step-by-step derivation
                1. unpow280.6%

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

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

              Alternative 5: 67.3% accurate, 3.6× speedup?

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

                1. Initial program 80.8%

                  \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                2. Step-by-step derivation
                  1. Simplified80.8%

                    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                  2. Add Preprocessing
                  3. Taylor expanded in angle around 0 60.0%

                    \[\leadsto \color{blue}{{a}^{2}} \]
                  4. Step-by-step derivation
                    1. unpow280.5%

                      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                  5. Applied egg-rr60.0%

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

                  if 4.50000000000000009e-90 < b

                  1. Initial program 79.9%

                    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                  2. Step-by-step derivation
                    1. Simplified79.9%

                      \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                    2. Add Preprocessing
                    3. Taylor expanded in angle around 0 80.9%

                      \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                    4. Step-by-step derivation
                      1. unpow280.9%

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

                      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                    6. Taylor expanded in angle around 0 78.2%

                      \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
                    7. Step-by-step derivation
                      1. associate-*r*78.2%

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

                        \[\leadsto a \cdot a + {\left(b \cdot \left(\color{blue}{\left(angle \cdot 0.005555555555555556\right)} \cdot \pi\right)\right)}^{2} \]
                      3. associate-*r*78.2%

                        \[\leadsto a \cdot a + {\left(b \cdot \color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}\right)}^{2} \]
                      4. *-commutative78.2%

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

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

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

                  Alternative 6: 67.3% accurate, 3.6× speedup?

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

                    1. Initial program 80.8%

                      \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                    2. Step-by-step derivation
                      1. Simplified80.8%

                        \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                      2. Add Preprocessing
                      3. Taylor expanded in angle around 0 60.0%

                        \[\leadsto \color{blue}{{a}^{2}} \]
                      4. Step-by-step derivation
                        1. unpow280.5%

                          \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                      5. Applied egg-rr60.0%

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

                      if 4.99999999999999997e-91 < b

                      1. Initial program 79.9%

                        \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                      2. Step-by-step derivation
                        1. Simplified79.9%

                          \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                        2. Add Preprocessing
                        3. Taylor expanded in angle around 0 80.9%

                          \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                        4. Step-by-step derivation
                          1. unpow280.9%

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

                          \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                        6. Taylor expanded in angle around 0 78.2%

                          \[\leadsto a \cdot a + {\color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
                        7. Step-by-step derivation
                          1. associate-*r*78.1%

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

                            \[\leadsto a \cdot a + {\left(\color{blue}{\left(angle \cdot 0.005555555555555556\right)} \cdot \left(b \cdot \pi\right)\right)}^{2} \]
                          3. associate-*r*78.1%

                            \[\leadsto a \cdot a + {\color{blue}{\left(angle \cdot \left(0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
                          4. *-commutative78.1%

                            \[\leadsto a \cdot a + {\left(angle \cdot \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot b\right)}\right)\right)}^{2} \]
                          5. associate-*r*78.2%

                            \[\leadsto a \cdot a + {\left(angle \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot b\right)}\right)}^{2} \]
                          6. *-commutative78.2%

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

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

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

                      Alternative 7: 67.3% accurate, 3.6× speedup?

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

                        1. Initial program 80.8%

                          \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                        2. Step-by-step derivation
                          1. Simplified80.8%

                            \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                          2. Add Preprocessing
                          3. Taylor expanded in angle around 0 60.0%

                            \[\leadsto \color{blue}{{a}^{2}} \]
                          4. Step-by-step derivation
                            1. unpow280.5%

                              \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                          5. Applied egg-rr60.0%

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

                          if 8.50000000000000067e-92 < b

                          1. Initial program 79.9%

                            \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          2. Step-by-step derivation
                            1. Simplified79.9%

                              \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                            2. Add Preprocessing
                            3. Taylor expanded in angle around 0 80.9%

                              \[\leadsto {\color{blue}{a}}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                            4. Step-by-step derivation
                              1. unpow280.9%

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

                              \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
                            6. Taylor expanded in angle around 0 78.2%

                              \[\leadsto a \cdot a + {\color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
                            7. Step-by-step derivation
                              1. *-commutative78.2%

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

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

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

                          Alternative 8: 56.7% accurate, 139.0× speedup?

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

                            \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                          2. Step-by-step derivation
                            1. Simplified80.5%

                              \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
                            2. Add Preprocessing
                            3. Taylor expanded in angle around 0 58.9%

                              \[\leadsto \color{blue}{{a}^{2}} \]
                            4. Step-by-step derivation
                              1. unpow280.6%

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

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

                            Reproduce

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