ab-angle->ABCF A

Percentage Accurate: 79.9% → 79.8%
Time: 12.5s
Alternatives: 7
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 79.9% accurate, 1.0× speedup?

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

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

Alternative 1: 79.8% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot a\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    5. Final simplification79.0%

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

    Alternative 2: 79.9% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \left(\color{blue}{\pi} \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    5. Simplified78.9%

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

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

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

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

      Alternative 3: 67.6% accurate, 2.0× speedup?

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

        1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{b \cdot b} \]
        8. Simplified64.4%

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

        if 3.2999999999999998e-19 < a

        1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 4: 71.0% accurate, 3.3× speedup?

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

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

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

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

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

            \[\leadsto \color{blue}{angle \cdot \left(\left(\left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
          4. Final simplification69.1%

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

          Alternative 5: 63.6% accurate, 10.4× speedup?

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

            1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(angle \cdot angle\right) \cdot \color{blue}{\left(\left(\frac{-1}{3149280000} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{4}\right)\right) \cdot {angle}^{2} + \frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \]
            5. Simplified53.0%

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

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

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

                \[\leadsto \color{blue}{b \cdot b} \]
            8. Simplified64.5%

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

            if 7.2e-40 < a

            1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 6: 61.5% accurate, 12.1× speedup?

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

            1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{b \cdot b} \]
            8. Simplified60.8%

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

            if 2.3000000000000001e153 < a

            1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(a \cdot a\right) \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \]
              19. lower-PI.f6470.7

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

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

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

          Alternative 7: 57.3% accurate, 74.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{b \cdot b} \]
          8. Simplified54.3%

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

          Reproduce

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