ab-angle->ABCF C

Percentage Accurate: 80.0% → 78.6%
Time: 14.6s
Alternatives: 10
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 10 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.0% 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: 78.6% accurate, 3.4× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;angle\_m \leq 3.4 \cdot 10^{-9}:\\ \;\;\;\;a \cdot a + \left(\left(angle\_m \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot angle\_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + \left(b \cdot b\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\pi}{\frac{180}{angle\_m}}\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= angle_m 3.4e-9)
   (+
    (* a a)
    (* (* (* angle_m 3.08641975308642e-5) (* b angle_m)) (* b (* PI PI))))
   (+
    (* a a)
    (* (* b b) (- 0.5 (* 0.5 (cos (* 2.0 (/ PI (/ 180.0 angle_m))))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (angle_m <= 3.4e-9) {
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (((double) M_PI) * ((double) M_PI))));
	} else {
		tmp = (a * a) + ((b * b) * (0.5 - (0.5 * cos((2.0 * (((double) M_PI) / (180.0 / angle_m)))))));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (angle_m <= 3.4e-9) {
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (Math.PI * Math.PI)));
	} else {
		tmp = (a * a) + ((b * b) * (0.5 - (0.5 * Math.cos((2.0 * (Math.PI / (180.0 / angle_m)))))));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if angle_m <= 3.4e-9:
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (math.pi * math.pi)))
	else:
		tmp = (a * a) + ((b * b) * (0.5 - (0.5 * math.cos((2.0 * (math.pi / (180.0 / angle_m)))))))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (angle_m <= 3.4e-9)
		tmp = Float64(Float64(a * a) + Float64(Float64(Float64(angle_m * 3.08641975308642e-5) * Float64(b * angle_m)) * Float64(b * Float64(pi * pi))));
	else
		tmp = Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(pi / Float64(180.0 / angle_m))))))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (angle_m <= 3.4e-9)
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (pi * pi)));
	else
		tmp = (a * a) + ((b * b) * (0.5 - (0.5 * cos((2.0 * (pi / (180.0 / angle_m)))))));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[angle$95$m, 3.4e-9], N[(N[(a * a), $MachinePrecision] + N[(N[(N[(angle$95$m * 3.08641975308642e-5), $MachinePrecision] * N[(b * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;angle\_m \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;a \cdot a + \left(\left(angle\_m \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot angle\_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot a + \left(b \cdot b\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\pi}{\frac{180}{angle\_m}}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 3.3999999999999998e-9

    1. Initial program 85.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6485.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified73.9%

      \[\leadsto \color{blue}{a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(angle \cdot \frac{1}{32400}\right), \left(angle \cdot b\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \left(angle \cdot b\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \left(b \cdot angle\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      13. PI-lowering-PI.f6481.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right)\right)\right)\right) \]
    10. Applied egg-rr81.3%

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

    if 3.3999999999999998e-9 < angle

    1. Initial program 63.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6465.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified65.2%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{180} \cdot angle\right)\right)\right), 2\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{180}\right), angle\right)\right)\right), 2\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), 180\right), angle\right)\right)\right), 2\right)\right) \]
      5. PI-lowering-PI.f6465.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), 180\right), angle\right)\right)\right), 2\right)\right) \]
    7. Applied egg-rr65.1%

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{\frac{180}{angle}}\right)\right) \cdot b\right) \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{\frac{180}{angle}}\right)\right), \color{blue}{\left(a \cdot a\right)}\right) \]
    9. Applied egg-rr65.0%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\pi}{\frac{180}{angle}}\right)\right) + a \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.9%

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

Alternative 2: 79.9% accurate, 2.0× speedup?

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

\\
a \cdot a + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    2. *-lowering-*.f6479.6%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
  5. Simplified79.6%

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

Alternative 3: 78.6% accurate, 3.4× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;angle\_m \leq 3.4 \cdot 10^{-9}:\\ \;\;\;\;a \cdot a + \left(\left(angle\_m \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot angle\_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + \left(b \cdot b\right) \cdot \left(0.5 + \cos \left(\left(\pi \cdot angle\_m\right) \cdot 0.011111111111111112\right) \cdot -0.5\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= angle_m 3.4e-9)
   (+
    (* a a)
    (* (* (* angle_m 3.08641975308642e-5) (* b angle_m)) (* b (* PI PI))))
   (+
    (* a a)
    (*
     (* b b)
     (+ 0.5 (* (cos (* (* PI angle_m) 0.011111111111111112)) -0.5))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (angle_m <= 3.4e-9) {
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (((double) M_PI) * ((double) M_PI))));
	} else {
		tmp = (a * a) + ((b * b) * (0.5 + (cos(((((double) M_PI) * angle_m) * 0.011111111111111112)) * -0.5)));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (angle_m <= 3.4e-9) {
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (Math.PI * Math.PI)));
	} else {
		tmp = (a * a) + ((b * b) * (0.5 + (Math.cos(((Math.PI * angle_m) * 0.011111111111111112)) * -0.5)));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if angle_m <= 3.4e-9:
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (math.pi * math.pi)))
	else:
		tmp = (a * a) + ((b * b) * (0.5 + (math.cos(((math.pi * angle_m) * 0.011111111111111112)) * -0.5)))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (angle_m <= 3.4e-9)
		tmp = Float64(Float64(a * a) + Float64(Float64(Float64(angle_m * 3.08641975308642e-5) * Float64(b * angle_m)) * Float64(b * Float64(pi * pi))));
	else
		tmp = Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(0.5 + Float64(cos(Float64(Float64(pi * angle_m) * 0.011111111111111112)) * -0.5))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (angle_m <= 3.4e-9)
		tmp = (a * a) + (((angle_m * 3.08641975308642e-5) * (b * angle_m)) * (b * (pi * pi)));
	else
		tmp = (a * a) + ((b * b) * (0.5 + (cos(((pi * angle_m) * 0.011111111111111112)) * -0.5)));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[angle$95$m, 3.4e-9], N[(N[(a * a), $MachinePrecision] + N[(N[(N[(angle$95$m * 3.08641975308642e-5), $MachinePrecision] * N[(b * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(0.5 + N[(N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;angle\_m \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;a \cdot a + \left(\left(angle\_m \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(b \cdot angle\_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot a + \left(b \cdot b\right) \cdot \left(0.5 + \cos \left(\left(\pi \cdot angle\_m\right) \cdot 0.011111111111111112\right) \cdot -0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 3.3999999999999998e-9

    1. Initial program 85.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6485.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified73.9%

      \[\leadsto \color{blue}{a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(angle \cdot \frac{1}{32400}\right), \left(angle \cdot b\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \left(angle \cdot b\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \left(b \cdot angle\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      13. PI-lowering-PI.f6481.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \frac{1}{32400}\right), \mathsf{*.f64}\left(b, angle\right)\right), \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right)\right)\right)\right) \]
    10. Applied egg-rr81.3%

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

    if 3.3999999999999998e-9 < angle

    1. Initial program 63.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6465.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified65.2%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \left({\left(\sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right) \cdot b\right)}^{2}\right)\right) \]
      3. unpow-prod-downN/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \left(\left(\sin \left(\frac{\mathsf{PI}\left(\right)}{\frac{180}{angle}}\right) \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{\frac{180}{angle}}\right)\right) \cdot {b}^{2}\right)\right) \]
      9. sqr-sin-aN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \frac{\mathsf{PI}\left(\right)}{\frac{180}{angle}}\right)\right), \color{blue}{\left({b}^{2}\right)}\right)\right) \]
    7. Applied egg-rr65.2%

      \[\leadsto a \cdot a + \color{blue}{\left(0.5 + \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right) \cdot -0.5\right) \cdot \left(b \cdot b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.9%

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

Alternative 4: 66.4% accurate, 18.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{+49}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 2.1e+49)
   (* a a)
   (+
    (* a a)
    (* 3.08641975308642e-5 (* (* b angle_m) (* angle_m (* b (* PI PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 2.1e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * ((b * angle_m) * (angle_m * (b * (((double) M_PI) * ((double) M_PI))))));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 2.1e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * ((b * angle_m) * (angle_m * (b * (Math.PI * Math.PI)))));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if b <= 2.1e+49:
		tmp = a * a
	else:
		tmp = (a * a) + (3.08641975308642e-5 * ((b * angle_m) * (angle_m * (b * (math.pi * math.pi)))))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 2.1e+49)
		tmp = Float64(a * a);
	else
		tmp = Float64(Float64(a * a) + Float64(3.08641975308642e-5 * Float64(Float64(b * angle_m) * Float64(angle_m * Float64(b * Float64(pi * pi))))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (b <= 2.1e+49)
		tmp = a * a;
	else
		tmp = (a * a) + (3.08641975308642e-5 * ((b * angle_m) * (angle_m * (b * (pi * pi)))));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.1e+49], N[(a * a), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(3.08641975308642e-5 * N[(N[(b * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.1 \cdot 10^{+49}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.10000000000000011e49

    1. Initial program 75.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. unpow2N/A

        \[\leadsto a \cdot \color{blue}{a} \]
      2. *-lowering-*.f6462.7%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
    5. Simplified62.7%

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

    if 2.10000000000000011e49 < b

    1. Initial program 92.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6492.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified92.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified74.9%

      \[\leadsto \color{blue}{a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \left(\left(\left(angle \cdot b\right) \cdot \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot angle\right)\right)\right) \]
      3. associate-*l*N/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), angle\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right), angle\right)\right)\right)\right) \]
      10. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right)\right), angle\right)\right)\right)\right) \]
      11. PI-lowering-PI.f6491.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right)\right), angle\right)\right)\right)\right) \]
    10. Applied egg-rr91.6%

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

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

Alternative 5: 65.4% accurate, 18.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.46 \cdot 10^{+49}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(b \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 1.46e+49)
   (* a a)
   (+
    (* a a)
    (* 3.08641975308642e-5 (* angle_m (* b (* (* b angle_m) (* PI PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 1.46e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (b * ((b * angle_m) * (((double) M_PI) * ((double) M_PI))))));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 1.46e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (b * ((b * angle_m) * (Math.PI * Math.PI)))));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if b <= 1.46e+49:
		tmp = a * a
	else:
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (b * ((b * angle_m) * (math.pi * math.pi)))))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 1.46e+49)
		tmp = Float64(a * a);
	else
		tmp = Float64(Float64(a * a) + Float64(3.08641975308642e-5 * Float64(angle_m * Float64(b * Float64(Float64(b * angle_m) * Float64(pi * pi))))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (b <= 1.46e+49)
		tmp = a * a;
	else
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (b * ((b * angle_m) * (pi * pi)))));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.46e+49], N[(a * a), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(3.08641975308642e-5 * N[(angle$95$m * N[(b * N[(N[(b * angle$95$m), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.46 \cdot 10^{+49}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.46000000000000008e49

    1. Initial program 75.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. unpow2N/A

        \[\leadsto a \cdot \color{blue}{a} \]
      2. *-lowering-*.f6462.7%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
    5. Simplified62.7%

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

    if 1.46000000000000008e49 < b

    1. Initial program 92.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6492.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified92.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified74.9%

      \[\leadsto \color{blue}{a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(angle \cdot b\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), b\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(b \cdot angle\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), b\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), b\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right), b\right)\right)\right)\right) \]
      9. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right)\right), b\right)\right)\right)\right) \]
      10. PI-lowering-PI.f6488.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right)\right), b\right)\right)\right)\right) \]
    10. Applied egg-rr88.3%

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

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

Alternative 6: 65.4% accurate, 18.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.8 \cdot 10^{+49}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(b \cdot \pi\right)\right)\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 1.8e+49)
   (* a a)
   (+
    (* a a)
    (* 3.08641975308642e-5 (* angle_m (* PI (* (* b angle_m) (* b PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 1.8e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (((double) M_PI) * ((b * angle_m) * (b * ((double) M_PI))))));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 1.8e+49) {
		tmp = a * a;
	} else {
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (Math.PI * ((b * angle_m) * (b * Math.PI)))));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if b <= 1.8e+49:
		tmp = a * a
	else:
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (math.pi * ((b * angle_m) * (b * math.pi)))))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 1.8e+49)
		tmp = Float64(a * a);
	else
		tmp = Float64(Float64(a * a) + Float64(3.08641975308642e-5 * Float64(angle_m * Float64(pi * Float64(Float64(b * angle_m) * Float64(b * pi))))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (b <= 1.8e+49)
		tmp = a * a;
	else
		tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (pi * ((b * angle_m) * (b * pi)))));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.8e+49], N[(a * a), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(3.08641975308642e-5 * N[(angle$95$m * N[(Pi * N[(N[(b * angle$95$m), $MachinePrecision] * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{+49}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.79999999999999998e49

    1. Initial program 75.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. unpow2N/A

        \[\leadsto a \cdot \color{blue}{a} \]
      2. *-lowering-*.f6462.7%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
    5. Simplified62.7%

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

    if 1.79999999999999998e49 < b

    1. Initial program 92.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6492.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified92.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified74.9%

      \[\leadsto \color{blue}{a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(angle \cdot b\right), \left(b \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(b \cdot angle\right), \left(b \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \left(b \cdot \mathsf{PI}\left(\right)\right)\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(b, \mathsf{PI}\left(\right)\right)\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      9. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(b, \mathsf{PI.f64}\left(\right)\right)\right), \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f6488.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(b, angle\right), \mathsf{*.f64}\left(b, \mathsf{PI.f64}\left(\right)\right)\right), \mathsf{PI.f64}\left(\right)\right)\right)\right)\right) \]
    10. Applied egg-rr88.2%

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

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

Alternative 7: 61.6% accurate, 23.1× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 5 \cdot 10^{+158}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;angle\_m \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 5e+158)
   (* a a)
   (* angle_m (* angle_m (* 3.08641975308642e-5 (* b (* b (* PI PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 5e+158) {
		tmp = a * a;
	} else {
		tmp = angle_m * (angle_m * (3.08641975308642e-5 * (b * (b * (((double) M_PI) * ((double) M_PI))))));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 5e+158) {
		tmp = a * a;
	} else {
		tmp = angle_m * (angle_m * (3.08641975308642e-5 * (b * (b * (Math.PI * Math.PI)))));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if b <= 5e+158:
		tmp = a * a
	else:
		tmp = angle_m * (angle_m * (3.08641975308642e-5 * (b * (b * (math.pi * math.pi)))))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 5e+158)
		tmp = Float64(a * a);
	else
		tmp = Float64(angle_m * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(b * Float64(b * Float64(pi * pi))))));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (b <= 5e+158)
		tmp = a * a;
	else
		tmp = angle_m * (angle_m * (3.08641975308642e-5 * (b * (b * (pi * pi)))));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 5e+158], N[(a * a), $MachinePrecision], N[(angle$95$m * N[(angle$95$m * N[(3.08641975308642e-5 * N[(b * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{+158}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;angle\_m \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 4.9999999999999996e158

    1. Initial program 75.9%

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

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

        \[\leadsto a \cdot \color{blue}{a} \]
      2. *-lowering-*.f6461.6%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
    5. Simplified61.6%

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

    if 4.9999999999999996e158 < b

    1. Initial program 99.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      16. PI-lowering-PI.f6472.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
    11. Simplified72.2%

      \[\leadsto \color{blue}{\left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*l*N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \left(\left(b \cdot b\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right)\right), angle\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \left(\left(\left(b \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{1}{32400}\right)\right), angle\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \left(\frac{1}{32400} \cdot \left(\left(b \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), angle\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \left(\left(b \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right), angle\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \left(b \cdot \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(b, \left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
      12. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
      13. PI-lowering-PI.f6478.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right)\right)\right)\right)\right), angle\right) \]
    13. Applied egg-rr78.7%

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

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

Alternative 8: 61.6% accurate, 23.1× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 2.4 \cdot 10^{+154}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\left(b \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(angle\_m \cdot angle\_m\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 2.4e+154)
   (* a a)
   (* b (* (* b (* 3.08641975308642e-5 (* PI PI))) (* angle_m angle_m)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 2.4e+154) {
		tmp = a * a;
	} else {
		tmp = b * ((b * (3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI)))) * (angle_m * angle_m));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 2.4e+154) {
		tmp = a * a;
	} else {
		tmp = b * ((b * (3.08641975308642e-5 * (Math.PI * Math.PI))) * (angle_m * angle_m));
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	tmp = 0
	if b <= 2.4e+154:
		tmp = a * a
	else:
		tmp = b * ((b * (3.08641975308642e-5 * (math.pi * math.pi))) * (angle_m * angle_m))
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 2.4e+154)
		tmp = Float64(a * a);
	else
		tmp = Float64(b * Float64(Float64(b * Float64(3.08641975308642e-5 * Float64(pi * pi))) * Float64(angle_m * angle_m)));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	tmp = 0.0;
	if (b <= 2.4e+154)
		tmp = a * a;
	else
		tmp = b * ((b * (3.08641975308642e-5 * (pi * pi))) * (angle_m * angle_m));
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.4e+154], N[(a * a), $MachinePrecision], N[(b * N[(N[(b * N[(3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.4 \cdot 10^{+154}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(\left(b \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right)\right) \cdot \left(angle\_m \cdot angle\_m\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.40000000000000015e154

    1. Initial program 75.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}{{a}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto a \cdot \color{blue}{a} \]
      2. *-lowering-*.f6461.8%

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
    5. Simplified61.8%

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

    if 2.40000000000000015e154 < b

    1. Initial program 99.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
      2. *-lowering-*.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
    8. Simplified76.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
      16. PI-lowering-PI.f6470.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(angle, angle\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right), \frac{1}{32400}\right)\right)\right) \]
    11. Simplified70.3%

      \[\leadsto \color{blue}{\left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)} \]
    12. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(b, \color{blue}{\left(\left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \cdot \left(angle \cdot angle\right)\right)}\right) \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right), \left(\color{blue}{angle} \cdot angle\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right), \left(angle \cdot angle\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right), \left(angle \cdot angle\right)\right)\right) \]
      9. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI}\left(\right)\right), \frac{1}{32400}\right)\right), \left(angle \cdot angle\right)\right)\right) \]
      10. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right), \frac{1}{32400}\right)\right), \left(angle \cdot angle\right)\right)\right) \]
      11. *-lowering-*.f6471.1%

        \[\leadsto \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{PI.f64}\left(\right)\right), \frac{1}{32400}\right)\right), \mathsf{*.f64}\left(angle, \color{blue}{angle}\right)\right)\right) \]
    13. Applied egg-rr71.1%

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

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

Alternative 9: 70.6% accurate, 24.5× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(angle\_m \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (* a a)
  (* 3.08641975308642e-5 (* angle_m (* angle_m (* b (* b (* PI PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return (a * a) + (3.08641975308642e-5 * (angle_m * (angle_m * (b * (b * (((double) M_PI) * ((double) M_PI)))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return (a * a) + (3.08641975308642e-5 * (angle_m * (angle_m * (b * (b * (Math.PI * Math.PI))))));
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return (a * a) + (3.08641975308642e-5 * (angle_m * (angle_m * (b * (b * (math.pi * math.pi))))))
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64(Float64(a * a) + Float64(3.08641975308642e-5 * Float64(angle_m * Float64(angle_m * Float64(b * Float64(b * Float64(pi * pi)))))))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = (a * a) + (3.08641975308642e-5 * (angle_m * (angle_m * (b * (b * (pi * pi))))));
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(N[(a * a), $MachinePrecision] + N[(3.08641975308642e-5 * N[(angle$95$m * N[(angle$95$m * N[(b * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

\\
a \cdot a + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(angle\_m \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 79.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 \mathsf{+.f64}\left(\color{blue}{\left({a}^{2}\right)}, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right), 2\right)\right) \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \mathsf{+.f64}\left(\left(a \cdot a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
    2. *-lowering-*.f6479.6%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{*.f64}\left(b, \mathsf{sin.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(angle, 180\right)\right)\right)\right)}, 2\right)\right) \]
  5. Simplified79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(\frac{1}{32400}, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(angle, \mathsf{*.f64}\left(b, \color{blue}{\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)}\right)\right)\right)\right)\right) \]
  8. Simplified70.6%

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

Alternative 10: 56.8% accurate, 139.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ a \cdot a \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return a * a;
}
angle_m = abs(angle)
real(8) function code(a, b, angle_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle_m
    code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return a * a;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return a * a
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64(a * a)
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = a * a;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

\\
a \cdot a
\end{array}
Derivation
  1. Initial program 79.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. unpow2N/A

      \[\leadsto a \cdot \color{blue}{a} \]
    2. *-lowering-*.f6456.8%

      \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{a}\right) \]
  5. Simplified56.8%

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

Reproduce

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