ab-angle->ABCF C

Percentage Accurate: 79.8% → 79.8%
Time: 15.4s
Alternatives: 11
Speedup: 1.0×

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 11 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.8% 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.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\\
\left(a \cdot \left(a \cdot t\_0\right)\right) \cdot t\_0 + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 81.0%

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. metadata-eval81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. metadata-eval81.0%

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

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

      \[\leadsto {\left(a \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \frac{angle}{180}\right)\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    4. div-inv81.0%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    5. metadata-eval81.0%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    6. associate-*r*81.1%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \color{blue}{\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    7. *-commutative81.1%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  6. Applied egg-rr81.1%

    \[\leadsto {\left(a \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  7. Taylor expanded in angle around inf 81.1%

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

      \[\leadsto {\left(a \cdot \color{blue}{\left(e^{\log \left(1 + \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} - 1\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    2. add-exp-log81.1%

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

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

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

Alternative 3: 79.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. metadata-eval81.0%

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

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

      \[\leadsto {\left(a \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \frac{angle}{180}\right)\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    4. div-inv81.0%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    5. metadata-eval81.0%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\pi \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    6. associate-*r*81.1%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \color{blue}{\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    7. *-commutative81.1%

      \[\leadsto {\left(a \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  6. Applied egg-rr81.1%

    \[\leadsto {\left(a \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  7. Taylor expanded in angle around inf 81.1%

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

      \[\leadsto {\left(a \cdot \color{blue}{\left(e^{\log \left(1 + \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} - 1\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    2. add-exp-log81.1%

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

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

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

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

Alternative 4: 79.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. metadata-eval81.0%

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

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

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

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

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

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

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

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

Alternative 5: 79.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 81.0%

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Final simplification81.0%

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

Alternative 6: 52.7% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out78.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. metadata-eval78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
      6. swap-sqr50.0%

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right) \cdot \left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
      7. unpow250.0%

        \[\leadsto \color{blue}{{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}} \]
    9. Simplified50.0%

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

    if 0.00125000000000000003 < a

    1. Initial program 89.2%

      \[{\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. Step-by-step derivation
      1. associate-*r/89.1%

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out89.1%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.8% accurate, 1.3× speedup?

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 52.7% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out78.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. metadata-eval78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
      6. swap-sqr50.0%

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right) \cdot \left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)} \]
      7. unpow250.0%

        \[\leadsto \color{blue}{{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}} \]
    9. Simplified50.0%

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

    if 4.80000000000000012e-4 < a

    1. Initial program 89.2%

      \[{\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. Step-by-step derivation
      1. associate-*r/89.1%

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out89.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)}^{2} \]
      3. unpow285.6%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)} \]
      4. swap-sqr85.6%

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

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

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

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

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

Alternative 9: 52.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\ \mathbf{if}\;a \leq 0.00044:\\ \;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* 0.005555555555555556 (* PI angle))))
   (if (<= a 0.00044) (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
	double t_0 = 0.005555555555555556 * (((double) M_PI) * angle);
	double tmp;
	if (a <= 0.00044) {
		tmp = pow((b * sin(t_0)), 2.0);
	} else {
		tmp = pow((a * cos(t_0)), 2.0);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = 0.005555555555555556 * (Math.PI * angle);
	double tmp;
	if (a <= 0.00044) {
		tmp = Math.pow((b * Math.sin(t_0)), 2.0);
	} else {
		tmp = Math.pow((a * Math.cos(t_0)), 2.0);
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = 0.005555555555555556 * (math.pi * angle)
	tmp = 0
	if a <= 0.00044:
		tmp = math.pow((b * math.sin(t_0)), 2.0)
	else:
		tmp = math.pow((a * math.cos(t_0)), 2.0)
	return tmp
function code(a, b, angle)
	t_0 = Float64(0.005555555555555556 * Float64(pi * angle))
	tmp = 0.0
	if (a <= 0.00044)
		tmp = Float64(b * sin(t_0)) ^ 2.0;
	else
		tmp = Float64(a * cos(t_0)) ^ 2.0;
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = 0.005555555555555556 * (pi * angle);
	tmp = 0.0;
	if (a <= 0.00044)
		tmp = (b * sin(t_0)) ^ 2.0;
	else
		tmp = (a * cos(t_0)) ^ 2.0;
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 0.00044], N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
\mathbf{if}\;a \leq 0.00044:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\


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

    1. Initial program 78.6%

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

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out78.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right) \]
      4. swap-sqr49.9%

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right) \cdot \left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)} \]
      5. unpow249.9%

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

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

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

    if 4.40000000000000016e-4 < a

    1. Initial program 89.2%

      \[{\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. Step-by-step derivation
      1. associate-*r/89.1%

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

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

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

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

        \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-rgt-neg-out89.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)}^{2} \]
      3. unpow285.6%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)} \]
      4. swap-sqr85.6%

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

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

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

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

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

Alternative 10: 57.3% accurate, 2.0× speedup?

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

\\
{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 81.0%

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)}^{2} \]
    3. unpow256.6%

      \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)} \]
    4. swap-sqr56.6%

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}} \]
  8. Final simplification56.6%

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

Alternative 11: 57.6% accurate, 139.0× speedup?

\[\begin{array}{l} \\ a \cdot a \end{array} \]
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
	return a * a;
}
real(8) function code(a, b, angle)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = a * a
end function
public static double code(double a, double b, double angle) {
	return a * a;
}
def code(a, b, angle):
	return a * a
function code(a, b, angle)
	return Float64(a * a)
end
function tmp = code(a, b, angle)
	tmp = a * a;
end
code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
\begin{array}{l}

\\
a \cdot a
\end{array}
Derivation
  1. Initial program 81.0%

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{-\pi \cdot angle}{-180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. distribute-rgt-neg-out81.0%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{a}^{2}} \]
  6. Step-by-step derivation
    1. unpow256.6%

      \[\leadsto \color{blue}{a \cdot a} \]
  7. Applied egg-rr56.6%

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

Reproduce

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