ab-angle->ABCF C

Percentage Accurate: 79.6% → 79.5%
Time: 22.5s
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: 79.6% 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: 79.5% accurate, 0.8× speedup?

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

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

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{-0.005555555555555556}\right)\right)\right)}^{2} \]
    3. rem-cube-cbrt80.0%

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

    \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left({\left(\sqrt[3]{angle \cdot \left(\pi \cdot -0.005555555555555556\right)}\right)}^{3}\right)}\right)}^{2} \]
  7. Step-by-step derivation
    1. rem-cube-cbrt80.0%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{\frac{1}{-180}}\right)\right)\right)}^{2} \]
    3. div-inv80.0%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi}{-180} \cdot angle\right)}\right)}^{2} \]
    5. add-sqr-sqrt42.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{-180} \cdot \color{blue}{\left(\sqrt{angle} \cdot \sqrt{angle}\right)}\right)\right)}^{2} \]
    6. associate-*r*42.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\frac{\pi}{-180} \cdot \sqrt{angle}\right) \cdot \sqrt{angle}\right)}\right)}^{2} \]
    7. div-inv42.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(\color{blue}{\left(\pi \cdot \frac{1}{-180}\right)} \cdot \sqrt{angle}\right) \cdot \sqrt{angle}\right)\right)}^{2} \]
    8. metadata-eval42.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(\left(\pi \cdot \color{blue}{-0.005555555555555556}\right) \cdot \sqrt{angle}\right) \cdot \sqrt{angle}\right)\right)}^{2} \]
  8. Applied egg-rr42.1%

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

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

Alternative 2: 79.3% accurate, 0.8× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left({\left(\sqrt[3]{\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m}\right)}^{3}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.4%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{-0.005555555555555556}\right)\right)\right)}^{2} \]
    3. rem-cube-cbrt80.0%

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

    \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left({\left(\sqrt[3]{angle \cdot \left(\pi \cdot -0.005555555555555556\right)}\right)}^{3}\right)}\right)}^{2} \]
  7. Final simplification80.0%

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

Alternative 3: 79.5% accurate, 1.3× speedup?

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

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

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

Alternative 4: 67.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := angle_m \cdot \left(-0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\\
\mathbf{if}\;b \leq 1.75 \cdot 10^{-85}:\\
\;\;\;\;{a}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2} + t_0 \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.74999999999999989e-85

    1. Initial program 77.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. Simplified77.1%

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

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

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

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{-0.005555555555555556}\right)\right)\right)}^{2} \]
      3. rem-cube-cbrt77.8%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{0}}^{2} \]

    if 1.74999999999999989e-85 < b

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\left(\left(angle \cdot b\right) \cdot \pi\right) \cdot -0.005555555555555556\right) \cdot \color{blue}{\left(\left(\left(angle \cdot b\right) \cdot \pi\right) \cdot -0.005555555555555556\right)} \]
      4. associate-*l*84.2%

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\color{blue}{\left(angle \cdot \left(b \cdot \pi\right)\right)} \cdot -0.005555555555555556\right) \cdot \left(\left(\left(angle \cdot b\right) \cdot \pi\right) \cdot -0.005555555555555556\right) \]
      5. associate-*l*84.2%

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(angle \cdot \left(\color{blue}{\left(\pi \cdot b\right)} \cdot -0.005555555555555556\right)\right) \cdot \left(\left(\left(angle \cdot b\right) \cdot \pi\right) \cdot -0.005555555555555556\right) \]
      7. associate-*l*84.2%

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(angle \cdot \left(\left(\pi \cdot b\right) \cdot -0.005555555555555556\right)\right) \cdot \left(\color{blue}{\left(angle \cdot \left(b \cdot \pi\right)\right)} \cdot -0.005555555555555556\right) \]
      8. associate-*l*84.1%

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(angle \cdot \left(\left(\pi \cdot b\right) \cdot -0.005555555555555556\right)\right) \cdot \left(angle \cdot \left(\color{blue}{\left(\pi \cdot b\right)} \cdot -0.005555555555555556\right)\right) \]
    8. Applied egg-rr84.1%

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

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

Alternative 5: 67.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7 \cdot 10^{-85}:\\
\;\;\;\;{a}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(-0.005555555555555556 \cdot \left(angle_m \cdot \left(-0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\right)\right) \cdot \left(angle_m \cdot \left(b \cdot \pi\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.69999999999999983e-85

    1. Initial program 77.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. Simplified77.1%

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

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

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

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{-0.005555555555555556}\right)\right)\right)}^{2} \]
      3. rem-cube-cbrt77.8%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{0}}^{2} \]

    if 3.69999999999999983e-85 < b

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(angle \cdot b\right) \cdot \pi\right) \cdot -0.005555555555555556\right)} \cdot -0.005555555555555556\right) \cdot \left(\left(angle \cdot b\right) \cdot \pi\right) \]
      4. associate-*l*84.2%

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\left(\color{blue}{\left(angle \cdot \left(b \cdot \pi\right)\right)} \cdot -0.005555555555555556\right) \cdot -0.005555555555555556\right) \cdot \left(\left(angle \cdot b\right) \cdot \pi\right) \]
      5. associate-*l*84.3%

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\left(angle \cdot \left(\color{blue}{\left(\pi \cdot b\right)} \cdot -0.005555555555555556\right)\right) \cdot -0.005555555555555556\right) \cdot \left(\left(angle \cdot b\right) \cdot \pi\right) \]
      7. associate-*l*84.2%

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

        \[\leadsto {\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(\left(angle \cdot \left(\left(\pi \cdot b\right) \cdot -0.005555555555555556\right)\right) \cdot -0.005555555555555556\right) \cdot \left(angle \cdot \color{blue}{\left(\pi \cdot b\right)}\right) \]
    8. Applied egg-rr84.2%

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

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

Alternative 6: 73.8% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{+168}:\\
\;\;\;\;{a}^{2} + \left(-0.005555555555555556 \cdot angle_m\right) \cdot \left(\left(b \cdot \pi\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + b \cdot \left(\left(\pi \cdot angle_m\right) \cdot \left(\left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right) \cdot \left(b \cdot -0.005555555555555556\right)\right)\right)\\


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

    1. Initial program 77.4%

      \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. Simplified77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999967e168 < b

    1. Initial program 99.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. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.2% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-138}:\\
\;\;\;\;{a}^{2}\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + -0.005555555555555556 \cdot \left(\left(b \cdot \left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot angle_m\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.80000000000000009e-138

    1. Initial program 76.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. Simplified76.8%

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

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

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{-180}\right)}\right)\right)}^{2} \]
      2. metadata-eval77.7%

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot \color{blue}{-0.005555555555555556}\right)\right)\right)}^{2} \]
      3. rem-cube-cbrt77.6%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{0}}^{2} \]

    if 1.80000000000000009e-138 < b

    1. Initial program 85.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. Simplified85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.3% accurate, 3.5× speedup?

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

\\
{a}^{2} + -0.005555555555555556 \cdot \left(b \cdot \left(\left(\pi \cdot angle_m\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 79.4%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 73.3% accurate, 3.5× speedup?

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

\\
{a}^{2} + \pi \cdot \left(b \cdot \left(\left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot angle_m\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 79.4%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 74.5% accurate, 3.5× speedup?

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

\\
{a}^{2} + -0.005555555555555556 \cdot \left(\left(b \cdot \left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot angle_m\right)\right)\right)
\end{array}
Derivation
  1. Initial program 79.4%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Simplified79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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