ab-angle->ABCF C

Percentage Accurate: 80.0% → 80.0%
Time: 21.7s
Alternatives: 6
Speedup: 1.3×

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

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

Initial Program: 80.0% accurate, 1.0× speedup?

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

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

Alternative 1: 80.0% accurate, 1.3× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 78.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. Simplified78.3%

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

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

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

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

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

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

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

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

Alternative 2: 80.0% accurate, 1.3× 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 78.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. Simplified78.3%

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

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

    \[\leadsto \color{blue}{{a}^{2}} + \left(\left(\sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right) \cdot b\right) \cdot \sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right) \cdot b \]
  6. Taylor expanded in angle around inf 65.2%

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

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

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

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

      \[\leadsto {a}^{2} + \left(b \cdot b\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-sqr78.8%

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

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

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

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

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

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

Alternative 3: 67.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.1 \cdot 10^{-51}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

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


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

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

    if 3.0999999999999997e-51 < b

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 67.7% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.9 \cdot 10^{-51}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

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


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

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

    if 3.8999999999999997e-51 < b

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot a + \left(\left(\pi \cdot \left(\left(angle \cdot b\right) \cdot -0.005555555555555556\right)\right) \cdot -0.005555555555555556\right) \cdot \color{blue}{\left(angle \cdot \left(b \cdot \pi\right)\right)} \]
    11. Applied egg-rr77.6%

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

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

Alternative 5: 75.0% accurate, 21.9× speedup?

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

\\
a \cdot a + \left(\pi \cdot -0.005555555555555556\right) \cdot \left(\left(b \cdot angle\right) \cdot \left(\pi \cdot \left(-0.005555555555555556 \cdot \left(b \cdot angle\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 78.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. Simplified78.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot a + \left(\color{blue}{\left(\pi \cdot -0.005555555555555556\right)} \cdot \left(angle \cdot b\right)\right) \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right) \]
    4. metadata-eval72.9%

      \[\leadsto a \cdot a + \left(\left(\pi \cdot \color{blue}{\frac{1}{-180}}\right) \cdot \left(angle \cdot b\right)\right) \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right) \]
    5. div-inv72.9%

      \[\leadsto a \cdot a + \left(\color{blue}{\frac{\pi}{-180}} \cdot \left(angle \cdot b\right)\right) \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right) \]
    6. associate-*l*73.0%

      \[\leadsto a \cdot a + \color{blue}{\frac{\pi}{-180} \cdot \left(\left(angle \cdot b\right) \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right)\right)} \]
    7. div-inv73.0%

      \[\leadsto a \cdot a + \color{blue}{\left(\pi \cdot \frac{1}{-180}\right)} \cdot \left(\left(angle \cdot b\right) \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right)\right) \]
    8. metadata-eval73.0%

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

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

      \[\leadsto a \cdot a + \left(\pi \cdot -0.005555555555555556\right) \cdot \left(\left(angle \cdot b\right) \cdot \color{blue}{\left(\pi \cdot \left(\left(angle \cdot b\right) \cdot -0.005555555555555556\right)\right)}\right) \]
  11. Applied egg-rr72.9%

    \[\leadsto a \cdot a + \color{blue}{\left(\pi \cdot -0.005555555555555556\right) \cdot \left(\left(angle \cdot b\right) \cdot \left(\pi \cdot \left(\left(angle \cdot b\right) \cdot -0.005555555555555556\right)\right)\right)} \]
  12. Final simplification72.9%

    \[\leadsto a \cdot a + \left(\pi \cdot -0.005555555555555556\right) \cdot \left(\left(b \cdot angle\right) \cdot \left(\pi \cdot \left(-0.005555555555555556 \cdot \left(b \cdot angle\right)\right)\right)\right) \]
  13. Add Preprocessing

Alternative 6: 75.0% accurate, 21.9× speedup?

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

\\
\left(-0.005555555555555556 \cdot \left(\pi \cdot \left(-0.005555555555555556 \cdot \left(b \cdot angle\right)\right)\right)\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right) + a \cdot a
\end{array}
Derivation
  1. Initial program 78.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. Simplified78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto a \cdot a + \color{blue}{\left(\left(\pi \cdot \left(\left(angle \cdot b\right) \cdot -0.005555555555555556\right)\right) \cdot -0.005555555555555556\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)} \]
  12. Final simplification73.0%

    \[\leadsto \left(-0.005555555555555556 \cdot \left(\pi \cdot \left(-0.005555555555555556 \cdot \left(b \cdot angle\right)\right)\right)\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right) + a \cdot a \]
  13. Add Preprocessing

Reproduce

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