ab-angle->ABCF C

Percentage Accurate: 79.7% → 79.7%
Time: 28.8s
Alternatives: 7
Speedup: 1.5×

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 7 alternatives:

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

Initial Program: 79.7% 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.7% accurate, 1.5× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\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. Taylor expanded in angle around 0 79.6%

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

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

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

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

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

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

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

Alternative 2: 79.7% accurate, 1.5× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\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. Taylor expanded in angle around 0 79.6%

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

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

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

Alternative 3: 75.4% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;b \leq 67000000000000:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -9.2000000000000005e38

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 81.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} \]
    4. Step-by-step derivation
      1. associate-*r*81.5%

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

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

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

    if -9.2000000000000005e38 < b < 6.7e13

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

    if 6.7e13 < b

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 80.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} \]
    4. Step-by-step derivation
      1. *-commutative80.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -9.2 \cdot 10^{+38}:\\ \;\;\;\;{a}^{2} + {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(b \cdot angle\right)\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 67000000000000:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(b \cdot \pi\right) \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\right)\right)\\ \end{array} \]

Alternative 4: 76.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{+38} \lor \neg \left(b \leq 67000000000000\right):\\ \;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (or (<= b -3.35e+38) (not (<= b 67000000000000.0)))
   (+ (pow a 2.0) (* (pow (* angle (* b PI)) 2.0) 3.08641975308642e-5))
   (+ (pow a 2.0) (pow (* b 0.0) 2.0))))
double code(double a, double b, double angle) {
	double tmp;
	if ((b <= -3.35e+38) || !(b <= 67000000000000.0)) {
		tmp = pow(a, 2.0) + (pow((angle * (b * ((double) M_PI))), 2.0) * 3.08641975308642e-5);
	} else {
		tmp = pow(a, 2.0) + pow((b * 0.0), 2.0);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double tmp;
	if ((b <= -3.35e+38) || !(b <= 67000000000000.0)) {
		tmp = Math.pow(a, 2.0) + (Math.pow((angle * (b * Math.PI)), 2.0) * 3.08641975308642e-5);
	} else {
		tmp = Math.pow(a, 2.0) + Math.pow((b * 0.0), 2.0);
	}
	return tmp;
}
def code(a, b, angle):
	tmp = 0
	if (b <= -3.35e+38) or not (b <= 67000000000000.0):
		tmp = math.pow(a, 2.0) + (math.pow((angle * (b * math.pi)), 2.0) * 3.08641975308642e-5)
	else:
		tmp = math.pow(a, 2.0) + math.pow((b * 0.0), 2.0)
	return tmp
function code(a, b, angle)
	tmp = 0.0
	if ((b <= -3.35e+38) || !(b <= 67000000000000.0))
		tmp = Float64((a ^ 2.0) + Float64((Float64(angle * Float64(b * pi)) ^ 2.0) * 3.08641975308642e-5));
	else
		tmp = Float64((a ^ 2.0) + (Float64(b * 0.0) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	tmp = 0.0;
	if ((b <= -3.35e+38) || ~((b <= 67000000000000.0)))
		tmp = (a ^ 2.0) + (((angle * (b * pi)) ^ 2.0) * 3.08641975308642e-5);
	else
		tmp = (a ^ 2.0) + ((b * 0.0) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := If[Or[LessEqual[b, -3.35e+38], N[Not[LessEqual[b, 67000000000000.0]], $MachinePrecision]], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * 0.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.35 \cdot 10^{+38} \lor \neg \left(b \leq 67000000000000\right):\\
\;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -3.35000000000000012e38 or 6.7e13 < b

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

    if -3.35000000000000012e38 < b < 6.7e13

    1. Initial program 75.7%

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \color{blue}{0}\right)}^{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{+38} \lor \neg \left(b \leq 67000000000000\right):\\ \;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \end{array} \]

Alternative 5: 76.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := angle \cdot \left(b \cdot \pi\right)\\ \mathbf{if}\;b \leq -3.35 \cdot 10^{+38}:\\ \;\;\;\;{a}^{2} + {\left(0.005555555555555556 \cdot t_0\right)}^{2}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+14}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {t_0}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* angle (* b PI))))
   (if (<= b -3.35e+38)
     (+ (pow a 2.0) (pow (* 0.005555555555555556 t_0) 2.0))
     (if (<= b 3.4e+14)
       (+ (pow a 2.0) (pow (* b 0.0) 2.0))
       (+ (pow a 2.0) (* (pow t_0 2.0) 3.08641975308642e-5))))))
double code(double a, double b, double angle) {
	double t_0 = angle * (b * ((double) M_PI));
	double tmp;
	if (b <= -3.35e+38) {
		tmp = pow(a, 2.0) + pow((0.005555555555555556 * t_0), 2.0);
	} else if (b <= 3.4e+14) {
		tmp = pow(a, 2.0) + pow((b * 0.0), 2.0);
	} else {
		tmp = pow(a, 2.0) + (pow(t_0, 2.0) * 3.08641975308642e-5);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = angle * (b * Math.PI);
	double tmp;
	if (b <= -3.35e+38) {
		tmp = Math.pow(a, 2.0) + Math.pow((0.005555555555555556 * t_0), 2.0);
	} else if (b <= 3.4e+14) {
		tmp = Math.pow(a, 2.0) + Math.pow((b * 0.0), 2.0);
	} else {
		tmp = Math.pow(a, 2.0) + (Math.pow(t_0, 2.0) * 3.08641975308642e-5);
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = angle * (b * math.pi)
	tmp = 0
	if b <= -3.35e+38:
		tmp = math.pow(a, 2.0) + math.pow((0.005555555555555556 * t_0), 2.0)
	elif b <= 3.4e+14:
		tmp = math.pow(a, 2.0) + math.pow((b * 0.0), 2.0)
	else:
		tmp = math.pow(a, 2.0) + (math.pow(t_0, 2.0) * 3.08641975308642e-5)
	return tmp
function code(a, b, angle)
	t_0 = Float64(angle * Float64(b * pi))
	tmp = 0.0
	if (b <= -3.35e+38)
		tmp = Float64((a ^ 2.0) + (Float64(0.005555555555555556 * t_0) ^ 2.0));
	elseif (b <= 3.4e+14)
		tmp = Float64((a ^ 2.0) + (Float64(b * 0.0) ^ 2.0));
	else
		tmp = Float64((a ^ 2.0) + Float64((t_0 ^ 2.0) * 3.08641975308642e-5));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = angle * (b * pi);
	tmp = 0.0;
	if (b <= -3.35e+38)
		tmp = (a ^ 2.0) + ((0.005555555555555556 * t_0) ^ 2.0);
	elseif (b <= 3.4e+14)
		tmp = (a ^ 2.0) + ((b * 0.0) ^ 2.0);
	else
		tmp = (a ^ 2.0) + ((t_0 ^ 2.0) * 3.08641975308642e-5);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.35e+38], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(0.005555555555555556 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.4e+14], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * 0.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 3.4 \cdot 10^{+14}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + {t_0}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.35000000000000012e38

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 81.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} \]
    4. Step-by-step derivation
      1. *-commutative81.5%

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

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

    if -3.35000000000000012e38 < b < 3.4e14

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

    if 3.4e14 < b

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 80.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} \]
    4. Step-by-step derivation
      1. *-commutative80.8%

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

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

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

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

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(angle \cdot \left(\pi \cdot b\right)\right)}^{2} \cdot \color{blue}{3.08641975308642 \cdot 10^{-5}} \]
    7. Applied egg-rr80.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{+38}:\\ \;\;\;\;{a}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+14}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \]

Alternative 6: 76.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{+38}:\\ \;\;\;\;{a}^{2} + {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(b \cdot angle\right)\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{+15}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= b -3.35e+38)
   (+ (pow a 2.0) (pow (* 0.005555555555555556 (* PI (* b angle))) 2.0))
   (if (<= b 1.4e+15)
     (+ (pow a 2.0) (pow (* b 0.0) 2.0))
     (+ (pow a 2.0) (* (pow (* angle (* b PI)) 2.0) 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
	double tmp;
	if (b <= -3.35e+38) {
		tmp = pow(a, 2.0) + pow((0.005555555555555556 * (((double) M_PI) * (b * angle))), 2.0);
	} else if (b <= 1.4e+15) {
		tmp = pow(a, 2.0) + pow((b * 0.0), 2.0);
	} else {
		tmp = pow(a, 2.0) + (pow((angle * (b * ((double) M_PI))), 2.0) * 3.08641975308642e-5);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double tmp;
	if (b <= -3.35e+38) {
		tmp = Math.pow(a, 2.0) + Math.pow((0.005555555555555556 * (Math.PI * (b * angle))), 2.0);
	} else if (b <= 1.4e+15) {
		tmp = Math.pow(a, 2.0) + Math.pow((b * 0.0), 2.0);
	} else {
		tmp = Math.pow(a, 2.0) + (Math.pow((angle * (b * Math.PI)), 2.0) * 3.08641975308642e-5);
	}
	return tmp;
}
def code(a, b, angle):
	tmp = 0
	if b <= -3.35e+38:
		tmp = math.pow(a, 2.0) + math.pow((0.005555555555555556 * (math.pi * (b * angle))), 2.0)
	elif b <= 1.4e+15:
		tmp = math.pow(a, 2.0) + math.pow((b * 0.0), 2.0)
	else:
		tmp = math.pow(a, 2.0) + (math.pow((angle * (b * math.pi)), 2.0) * 3.08641975308642e-5)
	return tmp
function code(a, b, angle)
	tmp = 0.0
	if (b <= -3.35e+38)
		tmp = Float64((a ^ 2.0) + (Float64(0.005555555555555556 * Float64(pi * Float64(b * angle))) ^ 2.0));
	elseif (b <= 1.4e+15)
		tmp = Float64((a ^ 2.0) + (Float64(b * 0.0) ^ 2.0));
	else
		tmp = Float64((a ^ 2.0) + Float64((Float64(angle * Float64(b * pi)) ^ 2.0) * 3.08641975308642e-5));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	tmp = 0.0;
	if (b <= -3.35e+38)
		tmp = (a ^ 2.0) + ((0.005555555555555556 * (pi * (b * angle))) ^ 2.0);
	elseif (b <= 1.4e+15)
		tmp = (a ^ 2.0) + ((b * 0.0) ^ 2.0);
	else
		tmp = (a ^ 2.0) + (((angle * (b * pi)) ^ 2.0) * 3.08641975308642e-5);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := If[LessEqual[b, -3.35e+38], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(0.005555555555555556 * N[(Pi * N[(b * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.4e+15], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * 0.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.4 \cdot 10^{+15}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.35000000000000012e38

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 81.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} \]
    4. Step-by-step derivation
      1. associate-*r*81.5%

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

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

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

    if -3.35000000000000012e38 < b < 1.4e15

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

    if 1.4e15 < b

    1. Initial program 85.3%

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

      \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Taylor expanded in angle around 0 80.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} \]
    4. Step-by-step derivation
      1. *-commutative80.8%

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

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

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

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

        \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(angle \cdot \left(\pi \cdot b\right)\right)}^{2} \cdot \color{blue}{3.08641975308642 \cdot 10^{-5}} \]
    7. Applied egg-rr80.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{+38}:\\ \;\;\;\;{a}^{2} + {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(b \cdot angle\right)\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{+15}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \]

Alternative 7: 57.2% accurate, 3.0× speedup?

\[\begin{array}{l} \\ {a}^{2} + {\left(b \cdot 0\right)}^{2} \end{array} \]
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b 0.0) 2.0)))
double code(double a, double b, double angle) {
	return pow(a, 2.0) + pow((b * 0.0), 2.0);
}
real(8) function code(a, b, angle)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = (a ** 2.0d0) + ((b * 0.0d0) ** 2.0d0)
end function
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0) + Math.pow((b * 0.0), 2.0);
}
def code(a, b, angle):
	return math.pow(a, 2.0) + math.pow((b * 0.0), 2.0)
function code(a, b, angle)
	return Float64((a ^ 2.0) + (Float64(b * 0.0) ^ 2.0))
end
function tmp = code(a, b, angle)
	tmp = (a ^ 2.0) + ((b * 0.0) ^ 2.0);
end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * 0.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{a}^{2} + {\left(b \cdot 0\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. Taylor expanded in angle around 0 79.6%

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

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

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

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

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

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

    \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \color{blue}{0}\right)}^{2} \]
  6. Final simplification62.2%

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

Reproduce

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