ab-angle->ABCF A

Percentage Accurate: 79.7% → 79.5%
Time: 14.0s
Alternatives: 9
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

Alternative 1: 79.5% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.5% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto b \cdot b + \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    7. swap-sqr82.8%

      \[\leadsto b \cdot b + \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    8. rem-square-sqrt82.8%

      \[\leadsto \color{blue}{\sqrt{b \cdot b + \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \cdot \sqrt{b \cdot b + \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}} \]
    9. hypot-undefine82.8%

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \cdot \sqrt{b \cdot b + \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    10. hypot-undefine82.8%

      \[\leadsto \mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \color{blue}{\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    11. unpow282.8%

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}} \]
  8. Simplified82.8%

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

Alternative 3: 66.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
\mathbf{if}\;a \leq 4.8 \cdot 10^{-65}:\\
\;\;\;\;{\left(b \cdot \cos t\_0\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(b, a \cdot t\_0\right)\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 4.8000000000000003e-65

    1. Initial program 79.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} \]
    6. Step-by-step derivation
      1. *-commutative63.9%

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

        \[\leadsto {b}^{2} \cdot {\cos \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      3. unpow263.8%

        \[\leadsto {b}^{2} \cdot \color{blue}{\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      4. unpow263.8%

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \]
      5. swap-sqr63.8%

        \[\leadsto \color{blue}{\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow263.8%

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

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

        \[\leadsto {\left(b \cdot \cos \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
    7. Simplified63.9%

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

    if 4.8000000000000003e-65 < a

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto b \cdot b + \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      7. swap-sqr89.3%

        \[\leadsto b \cdot b + \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      8. rem-square-sqrt89.2%

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

        \[\leadsto \color{blue}{\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \cdot \sqrt{b \cdot b + \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      10. hypot-undefine89.2%

        \[\leadsto \mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \color{blue}{\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      11. unpow289.2%

        \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}} \]
    8. Simplified89.3%

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(b, a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}^{2}} \]
    9. Taylor expanded in angle around 0 86.2%

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

Alternative 4: 52.4% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.5 \cdot 10^{-56}:\\
\;\;\;\;{\left(a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{b}^{2}\\


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

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr46.7%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow246.7%

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

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

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

        \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)}\right)}^{2} \]
    7. Simplified46.8%

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

    if 2.49999999999999999e-56 < b

    1. Initial program 81.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.4%

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

Alternative 5: 52.4% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.02 \cdot 10^{-57}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{b}^{2}\\


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

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr46.7%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow246.7%

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

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

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

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

    if 1.02e-57 < b

    1. Initial program 81.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 79.6% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 61.5% accurate, 3.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.6 \cdot 10^{+51}:\\
\;\;\;\;{b}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.60000000000000011e51

    1. Initial program 79.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 3.60000000000000011e51 < a

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow245.6%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr65.5%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow265.5%

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

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

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

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

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

Alternative 8: 61.5% accurate, 3.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \left(angle\_m \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\\ \mathbf{if}\;a \leq 3.6 \cdot 10^{+51}:\\ \;\;\;\;{b}^{2}\\ \mathbf{else}:\\ \;\;\;\;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 PI) (* a 0.005555555555555556))))
   (if (<= a 3.6e+51) (pow b 2.0) (* t_0 t_0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = (angle_m * ((double) M_PI)) * (a * 0.005555555555555556);
	double tmp;
	if (a <= 3.6e+51) {
		tmp = pow(b, 2.0);
	} else {
		tmp = 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 * Math.PI) * (a * 0.005555555555555556);
	double tmp;
	if (a <= 3.6e+51) {
		tmp = Math.pow(b, 2.0);
	} else {
		tmp = t_0 * t_0;
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	t_0 = (angle_m * math.pi) * (a * 0.005555555555555556)
	tmp = 0
	if a <= 3.6e+51:
		tmp = math.pow(b, 2.0)
	else:
		tmp = t_0 * t_0
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(Float64(angle_m * pi) * Float64(a * 0.005555555555555556))
	tmp = 0.0
	if (a <= 3.6e+51)
		tmp = b ^ 2.0;
	else
		tmp = 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 * pi) * (a * 0.005555555555555556);
	tmp = 0.0;
	if (a <= 3.6e+51)
		tmp = b ^ 2.0;
	else
		tmp = 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[(N[(angle$95$m * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3.6e+51], N[Power[b, 2.0], $MachinePrecision], N[(t$95$0 * t$95$0), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := \left(angle\_m \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a \leq 3.6 \cdot 10^{+51}:\\
\;\;\;\;{b}^{2}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.60000000000000011e51

    1. Initial program 79.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 3.60000000000000011e51 < a

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow245.6%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr65.5%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow265.5%

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

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

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

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

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

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

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

        \[\leadsto \left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right)} \]
    10. Applied egg-rr69.6%

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

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

Alternative 9: 38.3% accurate, 27.8× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \left(angle\_m \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\\ 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 PI) (* a 0.005555555555555556)))) (* t_0 t_0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = (angle_m * ((double) M_PI)) * (a * 0.005555555555555556);
	return t_0 * t_0;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double t_0 = (angle_m * Math.PI) * (a * 0.005555555555555556);
	return t_0 * t_0;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	t_0 = (angle_m * math.pi) * (a * 0.005555555555555556)
	return t_0 * t_0
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(Float64(angle_m * pi) * Float64(a * 0.005555555555555556))
	return Float64(t_0 * t_0)
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	t_0 = (angle_m * pi) * (a * 0.005555555555555556);
	tmp = t_0 * t_0;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := \left(angle\_m \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
    4. unpow234.8%

      \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    5. swap-sqr40.3%

      \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    6. unpow240.3%

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

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

      \[\leadsto {\left(a \cdot \sin \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
  7. Simplified40.4%

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

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

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

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

      \[\leadsto \left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right)} \]
  10. Applied egg-rr38.4%

    \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \pi\right)\right)} \]
  11. Final simplification38.4%

    \[\leadsto \left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right) \]
  12. Add Preprocessing

Reproduce

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