ab-angle->ABCF C

Percentage Accurate: 80.1% → 80.1%
Time: 7.6s
Alternatives: 13
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 13 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 := \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.1% accurate, 1.0× speedup?

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

\\
{\left(a \cdot \cos \left(-0.005555555555555556 \cdot \left(\left(angle \cdot \sqrt{\pi}\right) \cdot \sqrt{\pi}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 78.0%

    \[{\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. Add Preprocessing
  3. Taylor expanded in angle around 0

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

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

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

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

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

        Alternative 2: 67.4% accurate, 2.0× speedup?

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

          1. Initial program 73.4%

            \[{\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. Add Preprocessing
          3. Taylor expanded in a around inf

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

              \[\leadsto \color{blue}{\mathsf{fma}\left({\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, \frac{b}{a} \cdot \frac{b}{a}, {\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}\right) \cdot \left(a \cdot a\right)} \]
            2. Step-by-step derivation
              1. Applied rewrites67.9%

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

                \[\leadsto \left({\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot a\right) \cdot a \]
              3. Step-by-step derivation
                1. Applied rewrites54.2%

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

                if 1.45000000000000007e-54 < b

                1. Initial program 88.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. Add Preprocessing
                3. Taylor expanded in angle around 0

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

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

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

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

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

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

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

                    Alternative 3: 67.4% accurate, 2.0× speedup?

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

                      1. Initial program 73.4%

                        \[{\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. Add Preprocessing
                      3. Taylor expanded in a around inf

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left({\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, \frac{b}{a} \cdot \frac{b}{a}, {\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}\right) \cdot \left(a \cdot a\right)} \]
                        2. Taylor expanded in a around inf

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

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

                          if 1.45000000000000007e-54 < b

                          1. Initial program 88.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. Add Preprocessing
                          3. Taylor expanded in angle around 0

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

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

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

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

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

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

                              Alternative 4: 80.0% accurate, 2.0× speedup?

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

                                \[{\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. Add Preprocessing
                              3. Taylor expanded in angle around 0

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

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

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

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

                                  Alternative 5: 67.4% accurate, 3.4× speedup?

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

                                    1. Initial program 73.4%

                                      \[{\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. Add Preprocessing
                                    3. Taylor expanded in angle around 0

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

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

                                      if 2.15000000000000005e-55 < b

                                      1. Initial program 88.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. Add Preprocessing
                                      3. Taylor expanded in angle around 0

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

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

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

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

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

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

                                          Alternative 6: 54.1% accurate, 3.6× speedup?

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

                                            1. Initial program 75.6%

                                              \[{\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. Add Preprocessing
                                            3. Taylor expanded in angle around 0

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

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

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

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

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

                                                  if 1.4499999999999999e-115 < a < 1.1e116

                                                  1. Initial program 69.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. Add Preprocessing
                                                  3. Taylor expanded in angle around 0

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

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

                                                      \[\leadsto \mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\frac{1}{32400} \cdot {b}^{2}\right), angle \cdot angle, a \cdot a\right) \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites64.4%

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

                                                      if 1.1e116 < a

                                                      1. Initial program 98.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. Add Preprocessing
                                                      3. Taylor expanded in angle around 0

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

                                                          \[\leadsto \color{blue}{a \cdot a} \]
                                                      5. Recombined 3 regimes into one program.
                                                      6. Add Preprocessing

                                                      Alternative 7: 57.1% accurate, 8.8× speedup?

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

                                                        1. Initial program 74.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. Add Preprocessing
                                                        3. Taylor expanded in angle around 0

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

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

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

                                                            if 1.1e116 < a

                                                            1. Initial program 98.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. Add Preprocessing
                                                            3. Taylor expanded in angle around 0

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

                                                                \[\leadsto \color{blue}{a \cdot a} \]
                                                            5. Recombined 2 regimes into one program.
                                                            6. Add Preprocessing

                                                            Alternative 8: 61.8% accurate, 10.4× speedup?

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

                                                              1. Initial program 84.3%

                                                                \[{\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. Add Preprocessing
                                                              3. Taylor expanded in angle around 0

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

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

                                                                if 2.2499999999999999e-154 < angle

                                                                1. Initial program 68.2%

                                                                  \[{\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. Add Preprocessing
                                                                3. Taylor expanded in angle around 0

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

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

                                                                    \[\leadsto \mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\frac{1}{32400} \cdot {b}^{2}\right), angle \cdot angle, a \cdot a\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites59.7%

                                                                      \[\leadsto \mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right), angle \cdot angle, a \cdot a\right) \]
                                                                  4. Recombined 2 regimes into one program.
                                                                  5. Add Preprocessing

                                                                  Alternative 9: 61.7% accurate, 12.1× speedup?

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

                                                                    1. Initial program 74.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. Add Preprocessing
                                                                    3. Taylor expanded in angle around 0

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

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

                                                                      if 6.60000000000000005e137 < b

                                                                      1. Initial program 99.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. Add Preprocessing
                                                                      3. Taylor expanded in angle around 0

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

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

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

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

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

                                                                          Alternative 10: 61.7% accurate, 12.1× speedup?

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

                                                                            1. Initial program 74.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. Add Preprocessing
                                                                            3. Taylor expanded in angle around 0

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

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

                                                                              if 6.60000000000000005e137 < b

                                                                              1. Initial program 99.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. Add Preprocessing
                                                                              3. Taylor expanded in angle around 0

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

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

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

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

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

                                                                                  Alternative 11: 60.8% accurate, 12.1× speedup?

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

                                                                                    1. Initial program 74.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. Add Preprocessing
                                                                                    3. Taylor expanded in angle around 0

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

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

                                                                                      if 6.60000000000000005e137 < b

                                                                                      1. Initial program 99.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. Add Preprocessing
                                                                                      3. Taylor expanded in angle around 0

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

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

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

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

                                                                                        Alternative 12: 60.8% accurate, 12.1× speedup?

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

                                                                                          1. Initial program 74.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. Add Preprocessing
                                                                                          3. Taylor expanded in angle around 0

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

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

                                                                                            if 6.60000000000000005e137 < b

                                                                                            1. Initial program 99.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. Add Preprocessing
                                                                                            3. Taylor expanded in angle around 0

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

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

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

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

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

                                                                                                Alternative 13: 56.6% accurate, 74.7× speedup?

                                                                                                \[\begin{array}{l} \\ a \cdot a \end{array} \]
                                                                                                (FPCore (a b angle) :precision binary64 (* a a))
                                                                                                double code(double a, double b, double angle) {
                                                                                                	return a * a;
                                                                                                }
                                                                                                
                                                                                                module fmin_fmax_functions
                                                                                                    implicit none
                                                                                                    private
                                                                                                    public fmax
                                                                                                    public fmin
                                                                                                
                                                                                                    interface fmax
                                                                                                        module procedure fmax88
                                                                                                        module procedure fmax44
                                                                                                        module procedure fmax84
                                                                                                        module procedure fmax48
                                                                                                    end interface
                                                                                                    interface fmin
                                                                                                        module procedure fmin88
                                                                                                        module procedure fmin44
                                                                                                        module procedure fmin84
                                                                                                        module procedure fmin48
                                                                                                    end interface
                                                                                                contains
                                                                                                    real(8) function fmax88(x, y) result (res)
                                                                                                        real(8), intent (in) :: x
                                                                                                        real(8), intent (in) :: y
                                                                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(4) function fmax44(x, y) result (res)
                                                                                                        real(4), intent (in) :: x
                                                                                                        real(4), intent (in) :: y
                                                                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(8) function fmax84(x, y) result(res)
                                                                                                        real(8), intent (in) :: x
                                                                                                        real(4), intent (in) :: y
                                                                                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(8) function fmax48(x, y) result(res)
                                                                                                        real(4), intent (in) :: x
                                                                                                        real(8), intent (in) :: y
                                                                                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(8) function fmin88(x, y) result (res)
                                                                                                        real(8), intent (in) :: x
                                                                                                        real(8), intent (in) :: y
                                                                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(4) function fmin44(x, y) result (res)
                                                                                                        real(4), intent (in) :: x
                                                                                                        real(4), intent (in) :: y
                                                                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(8) function fmin84(x, y) result(res)
                                                                                                        real(8), intent (in) :: x
                                                                                                        real(4), intent (in) :: y
                                                                                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                    end function
                                                                                                    real(8) function fmin48(x, y) result(res)
                                                                                                        real(4), intent (in) :: x
                                                                                                        real(8), intent (in) :: y
                                                                                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                    end function
                                                                                                end module
                                                                                                
                                                                                                real(8) function code(a, b, angle)
                                                                                                use fmin_fmax_functions
                                                                                                    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 78.0%

                                                                                                  \[{\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. Add Preprocessing
                                                                                                3. Taylor expanded in angle around 0

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

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

                                                                                                  Reproduce

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