ab-angle->ABCF C

Percentage Accurate: 80.4% → 80.4%
Time: 3.7s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\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} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* PI (/ angle 180))))
  (+ (pow (* a (cos t_0)) 2) (pow (* b (sin t_0)) 2))))
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), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\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}

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

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

Initial Program: 80.4% accurate, 1.0× speedup?

\[\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} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* PI (/ angle 180))))
  (+ (pow (* a (cos t_0)) 2) (pow (* b (sin t_0)) 2))))
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), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\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}

Alternative 1: 80.4% accurate, 0.9× speedup?

\[\begin{array}{l} t_0 := \frac{1}{\frac{\frac{180}{angle}}{\pi}}\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (/ 1 (/ (/ 180 angle) PI))))
  (+ (pow (* a (cos t_0)) 2) (pow (* b (sin t_0)) 2))))
double code(double a, double b, double angle) {
	double t_0 = 1.0 / ((180.0 / angle) / ((double) M_PI));
	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 = 1.0 / ((180.0 / angle) / Math.PI);
	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 = 1.0 / ((180.0 / angle) / math.pi)
	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(1.0 / Float64(Float64(180.0 / angle) / pi))
	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 = 1.0 / ((180.0 / angle) / pi);
	tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(1 / N[(N[(180 / angle), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{\frac{\frac{180}{angle}}{\pi}}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.4%

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

      \[\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} \]
    2. lift-/.f64N/A

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

      \[\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} \]
    4. div-flipN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. lower-unsound-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-unsound-/.f64N/A

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

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

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

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\pi \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi \cdot angle}{180}\right)}\right)}^{2} \]
    4. div-flipN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)}\right)}^{2} \]
    5. lower-unsound-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)}\right)}^{2} \]
    6. lower-unsound-/.f64N/A

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

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

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

    \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)}\right)}^{2} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{\frac{180}{angle}}{\pi}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} \]
    4. lower-/.f64N/A

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

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

    \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{\frac{180}{angle}}{\pi}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} \]
  8. Step-by-step derivation
    1. lift-/.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{\frac{180}{angle}}{\pi}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{\color{blue}{\frac{\frac{180}{angle}}{\pi}}}\right)\right)}^{2} \]
    4. lower-/.f64N/A

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

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

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

Alternative 2: 80.4% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left(\frac{1}{180} \cdot \pi\right) \cdot angle\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (* 1/180 PI) angle)))
  (+ (pow (* a (cos t_0)) 2) (pow (* b (sin t_0)) 2))))
double code(double a, double b, double angle) {
	double t_0 = (0.005555555555555556 * ((double) M_PI)) * angle;
	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 = (0.005555555555555556 * Math.PI) * angle;
	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 = (0.005555555555555556 * math.pi) * angle
	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(Float64(0.005555555555555556 * pi) * angle)
	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 = (0.005555555555555556 * pi) * angle;
	tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(1/180 * Pi), $MachinePrecision] * angle), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(\frac{1}{180} \cdot \pi\right) \cdot angle\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.4%

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

      \[\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} \]
    2. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{angle}{180} \cdot \pi\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    4. mult-flipN/A

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    7. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    8. lower-*.f64N/A

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

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

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right)\right)}^{2} \]
    4. mult-flipN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}\right)}^{2} \]
    7. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}\right)}^{2} \]
    8. lower-*.f64N/A

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

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

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

Alternative 3: 80.4% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left(\frac{1}{180} \cdot angle\right) \cdot \pi\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (* 1/180 angle) PI)))
  (+ (pow (* a (cos t_0)) 2) (pow (* b (sin t_0)) 2))))
double code(double a, double b, double angle) {
	double t_0 = (0.005555555555555556 * angle) * ((double) M_PI);
	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 = (0.005555555555555556 * angle) * Math.PI;
	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 = (0.005555555555555556 * angle) * math.pi
	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(Float64(0.005555555555555556 * angle) * pi)
	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 = (0.005555555555555556 * angle) * pi;
	tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(1/180 * angle), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(\frac{1}{180} \cdot angle\right) \cdot \pi\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.4%

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

      \[\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} \]
    2. *-commutativeN/A

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{angle}{180} \cdot \pi\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    4. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. mult-flipN/A

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

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left(\frac{1}{180} \cdot angle\right)} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    7. lower-*.f64N/A

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

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

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
    4. lift-/.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(\frac{1}{180} \cdot angle\right)} \cdot \pi\right)\right)}^{2} \]
    7. lower-*.f64N/A

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

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

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

Alternative 4: 80.4% accurate, 1.6× speedup?

\[\begin{array}{l} t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\ t_1 := \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot \left|angle\right|\right)\\ \mathbf{if}\;\left|angle\right| \leq \frac{3458764513820541}{4611686018427387904}:\\ \;\;\;\;\left(\left(\cos \left(\frac{-1}{90} \cdot \left(\left|angle\right| \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\frac{1}{2} - t\_1\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + t\_1\right) \cdot a\right) \cdot a\\ \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (* (* b PI) (fabs angle)) 1/180))
       (t_1 (* 1/2 (cos (* (* 1/90 PI) (fabs angle))))))
  (if (<= (fabs angle) 3458764513820541/4611686018427387904)
    (+
     (* (* (+ (cos (* -1/90 (* (fabs angle) PI))) 1) 1/2) (* a a))
     (* t_0 t_0))
    (+ (* (* (- 1/2 t_1) b) b) (* (* (+ 1/2 t_1) a) a)))))
double code(double a, double b, double angle) {
	double t_0 = ((b * ((double) M_PI)) * fabs(angle)) * 0.005555555555555556;
	double t_1 = 0.5 * cos(((0.011111111111111112 * ((double) M_PI)) * fabs(angle)));
	double tmp;
	if (fabs(angle) <= 0.00075) {
		tmp = (((cos((-0.011111111111111112 * (fabs(angle) * ((double) M_PI)))) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = (((0.5 - t_1) * b) * b) + (((0.5 + t_1) * a) * a);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = ((b * Math.PI) * Math.abs(angle)) * 0.005555555555555556;
	double t_1 = 0.5 * Math.cos(((0.011111111111111112 * Math.PI) * Math.abs(angle)));
	double tmp;
	if (Math.abs(angle) <= 0.00075) {
		tmp = (((Math.cos((-0.011111111111111112 * (Math.abs(angle) * Math.PI))) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = (((0.5 - t_1) * b) * b) + (((0.5 + t_1) * a) * a);
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = ((b * math.pi) * math.fabs(angle)) * 0.005555555555555556
	t_1 = 0.5 * math.cos(((0.011111111111111112 * math.pi) * math.fabs(angle)))
	tmp = 0
	if math.fabs(angle) <= 0.00075:
		tmp = (((math.cos((-0.011111111111111112 * (math.fabs(angle) * math.pi))) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0)
	else:
		tmp = (((0.5 - t_1) * b) * b) + (((0.5 + t_1) * a) * a)
	return tmp
function code(a, b, angle)
	t_0 = Float64(Float64(Float64(b * pi) * abs(angle)) * 0.005555555555555556)
	t_1 = Float64(0.5 * cos(Float64(Float64(0.011111111111111112 * pi) * abs(angle))))
	tmp = 0.0
	if (abs(angle) <= 0.00075)
		tmp = Float64(Float64(Float64(Float64(cos(Float64(-0.011111111111111112 * Float64(abs(angle) * pi))) + 1.0) * 0.5) * Float64(a * a)) + Float64(t_0 * t_0));
	else
		tmp = Float64(Float64(Float64(Float64(0.5 - t_1) * b) * b) + Float64(Float64(Float64(0.5 + t_1) * a) * a));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = ((b * pi) * abs(angle)) * 0.005555555555555556;
	t_1 = 0.5 * cos(((0.011111111111111112 * pi) * abs(angle)));
	tmp = 0.0;
	if (abs(angle) <= 0.00075)
		tmp = (((cos((-0.011111111111111112 * (abs(angle) * pi))) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	else
		tmp = (((0.5 - t_1) * b) * b) + (((0.5 + t_1) * a) * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(N[(b * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * 1/180), $MachinePrecision]}, Block[{t$95$1 = N[(1/2 * N[Cos[N[(N[(1/90 * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[angle], $MachinePrecision], 3458764513820541/4611686018427387904], N[(N[(N[(N[(N[Cos[N[(-1/90 * N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1), $MachinePrecision] * 1/2), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1/2 - t$95$1), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision] + N[(N[(N[(1/2 + t$95$1), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\
t_1 := \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot \left|angle\right|\right)\\
\mathbf{if}\;\left|angle\right| \leq \frac{3458764513820541}{4611686018427387904}:\\
\;\;\;\;\left(\left(\cos \left(\frac{-1}{90} \cdot \left(\left|angle\right| \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{2} - t\_1\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + t\_1\right) \cdot a\right) \cdot a\\


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

    1. Initial program 80.4%

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
      3. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
      4. lower-PI.f6475.8%

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    4. Applied rewrites75.8%

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right)} \]

    if 7.5000000000000002e-4 < angle

    1. Initial program 80.4%

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

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)}\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\color{blue}{\left(angle \cdot \pi\right)} \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      3. associate-*l*N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(angle \cdot \left(\pi \cdot \frac{1}{90}\right)\right)}\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\pi \cdot \frac{1}{90}\right) \cdot angle\right)}\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\pi \cdot \frac{1}{90}\right) \cdot angle\right)}\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      6. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \pi\right)} \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      7. lower-*.f6468.2%

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \pi\right)} \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
    4. Applied rewrites68.2%

      \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)}\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \color{blue}{\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)}\right) \cdot a\right) \cdot a \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\color{blue}{\left(angle \cdot \pi\right)} \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a \]
      3. associate-*l*N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \color{blue}{\left(angle \cdot \left(\pi \cdot \frac{1}{90}\right)\right)}\right) \cdot a\right) \cdot a \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\pi \cdot \frac{1}{90}\right) \cdot angle\right)}\right) \cdot a\right) \cdot a \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\pi \cdot \frac{1}{90}\right) \cdot angle\right)}\right) \cdot a\right) \cdot a \]
      6. *-commutativeN/A

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \pi\right)} \cdot angle\right)\right) \cdot a\right) \cdot a \]
      7. lower-*.f6468.3%

        \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\color{blue}{\left(\frac{1}{90} \cdot \pi\right)} \cdot angle\right)\right) \cdot a\right) \cdot a \]
    6. Applied rewrites68.3%

      \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \color{blue}{\left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)}\right) \cdot a\right) \cdot a \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 80.3% accurate, 1.3× speedup?

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

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

      \[\leadsto \color{blue}{{\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. unpow2N/A

      \[\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 \frac{angle}{180}\right)\right)}^{2} \]
    3. lift-*.f64N/A

      \[\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 \frac{angle}{180}\right)\right)}^{2} \]
    4. lift-*.f64N/A

      \[\leadsto \left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \color{blue}{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. swap-sqrN/A

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

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

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

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

Alternative 6: 80.3% accurate, 1.8× speedup?

\[\begin{array}{l} t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\ t_1 := \frac{-1}{90} \cdot \left(\left|angle\right| \cdot \pi\right)\\ \mathbf{if}\;\left|angle\right| \leq 350:\\ \;\;\;\;\left(\left(\cos t\_1 + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(t\_1 + \frac{1}{2} \cdot \pi\right)\right) \cdot \left(b \cdot b\right)\\ \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (* (* b PI) (fabs angle)) 1/180))
       (t_1 (* -1/90 (* (fabs angle) PI))))
  (if (<= (fabs angle) 350)
    (+ (* (* (+ (cos t_1) 1) 1/2) (* a a)) (* t_0 t_0))
    (+
     (pow a 2)
     (* (- 1/2 (* 1/2 (sin (+ t_1 (* 1/2 PI))))) (* b b))))))
double code(double a, double b, double angle) {
	double t_0 = ((b * ((double) M_PI)) * fabs(angle)) * 0.005555555555555556;
	double t_1 = -0.011111111111111112 * (fabs(angle) * ((double) M_PI));
	double tmp;
	if (fabs(angle) <= 350.0) {
		tmp = (((cos(t_1) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = pow(a, 2.0) + ((0.5 - (0.5 * sin((t_1 + (0.5 * ((double) M_PI)))))) * (b * b));
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = ((b * Math.PI) * Math.abs(angle)) * 0.005555555555555556;
	double t_1 = -0.011111111111111112 * (Math.abs(angle) * Math.PI);
	double tmp;
	if (Math.abs(angle) <= 350.0) {
		tmp = (((Math.cos(t_1) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = Math.pow(a, 2.0) + ((0.5 - (0.5 * Math.sin((t_1 + (0.5 * Math.PI))))) * (b * b));
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = ((b * math.pi) * math.fabs(angle)) * 0.005555555555555556
	t_1 = -0.011111111111111112 * (math.fabs(angle) * math.pi)
	tmp = 0
	if math.fabs(angle) <= 350.0:
		tmp = (((math.cos(t_1) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0)
	else:
		tmp = math.pow(a, 2.0) + ((0.5 - (0.5 * math.sin((t_1 + (0.5 * math.pi))))) * (b * b))
	return tmp
function code(a, b, angle)
	t_0 = Float64(Float64(Float64(b * pi) * abs(angle)) * 0.005555555555555556)
	t_1 = Float64(-0.011111111111111112 * Float64(abs(angle) * pi))
	tmp = 0.0
	if (abs(angle) <= 350.0)
		tmp = Float64(Float64(Float64(Float64(cos(t_1) + 1.0) * 0.5) * Float64(a * a)) + Float64(t_0 * t_0));
	else
		tmp = Float64((a ^ 2.0) + Float64(Float64(0.5 - Float64(0.5 * sin(Float64(t_1 + Float64(0.5 * pi))))) * Float64(b * b)));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = ((b * pi) * abs(angle)) * 0.005555555555555556;
	t_1 = -0.011111111111111112 * (abs(angle) * pi);
	tmp = 0.0;
	if (abs(angle) <= 350.0)
		tmp = (((cos(t_1) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	else
		tmp = (a ^ 2.0) + ((0.5 - (0.5 * sin((t_1 + (0.5 * pi))))) * (b * b));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(N[(b * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * 1/180), $MachinePrecision]}, Block[{t$95$1 = N[(-1/90 * N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[angle], $MachinePrecision], 350], N[(N[(N[(N[(N[Cos[t$95$1], $MachinePrecision] + 1), $MachinePrecision] * 1/2), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2], $MachinePrecision] + N[(N[(1/2 - N[(1/2 * N[Sin[N[(t$95$1 + N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\
t_1 := \frac{-1}{90} \cdot \left(\left|angle\right| \cdot \pi\right)\\
\mathbf{if}\;\left|angle\right| \leq 350:\\
\;\;\;\;\left(\left(\cos t\_1 + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(t\_1 + \frac{1}{2} \cdot \pi\right)\right) \cdot \left(b \cdot b\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 350

    1. Initial program 80.4%

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
      3. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
      4. lower-PI.f6475.8%

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    4. Applied rewrites75.8%

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right)} \]

    if 350 < angle

    1. Initial program 80.4%

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

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

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

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)} \cdot \left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \]
      4. lift-*.f64N/A

        \[\leadsto {\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) \cdot \color{blue}{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)} \]
      5. swap-sqrN/A

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right)} \]
    4. Step-by-step derivation
      1. lift-cos.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)}\right) \cdot \left(b \cdot b\right) \]
      2. cos-neg-revN/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\mathsf{neg}\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right)}\right) \cdot \left(b \cdot b\right) \]
      3. sin-+PI/2-revN/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\sin \left(\left(\mathsf{neg}\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}\right) \cdot \left(b \cdot b\right) \]
      4. lower-sin.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\sin \left(\left(\mathsf{neg}\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}\right) \cdot \left(b \cdot b\right) \]
      5. lower-+.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \color{blue}{\left(\left(\mathsf{neg}\left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}\right) \cdot \left(b \cdot b\right) \]
      6. lift-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\left(\mathsf{neg}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot \frac{1}{90}}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      7. *-commutativeN/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{90} \cdot \left(angle \cdot \pi\right)}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{90}\right)\right) \cdot \left(angle \cdot \pi\right)} + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      9. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{90}\right)\right) \cdot \left(angle \cdot \pi\right)} + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      10. metadata-evalN/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\color{blue}{\frac{-1}{90}} \cdot \left(angle \cdot \pi\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      11. lift-PI.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{\color{blue}{\pi}}{2}\right)\right) \cdot \left(b \cdot b\right) \]
      12. mult-flipN/A

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

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \pi \cdot \color{blue}{\frac{1}{2}}\right)\right) \cdot \left(b \cdot b\right) \]
      14. *-commutativeN/A

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

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

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

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

        \[\leadsto {a}^{\color{blue}{2}} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{1}{2} \cdot \pi\right)\right) \cdot \left(b \cdot b\right) \]
    8. Applied rewrites62.6%

      \[\leadsto \color{blue}{{a}^{2}} + \left(\frac{1}{2} - \frac{1}{2} \cdot \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{1}{2} \cdot \pi\right)\right) \cdot \left(b \cdot b\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 80.3% accurate, 1.8× speedup?

\[\begin{array}{l} t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\ t_1 := \left|angle\right| \cdot \pi\\ \mathbf{if}\;\left|angle\right| \leq 350:\\ \;\;\;\;\left(\left(\cos \left(\frac{-1}{90} \cdot t\_1\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(t\_1 \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right)\\ \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (* (* b PI) (fabs angle)) 1/180))
       (t_1 (* (fabs angle) PI)))
  (if (<= (fabs angle) 350)
    (+ (* (* (+ (cos (* -1/90 t_1)) 1) 1/2) (* a a)) (* t_0 t_0))
    (+ (pow a 2) (* (- 1/2 (* 1/2 (cos (* t_1 1/90)))) (* b b))))))
double code(double a, double b, double angle) {
	double t_0 = ((b * ((double) M_PI)) * fabs(angle)) * 0.005555555555555556;
	double t_1 = fabs(angle) * ((double) M_PI);
	double tmp;
	if (fabs(angle) <= 350.0) {
		tmp = (((cos((-0.011111111111111112 * t_1)) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = pow(a, 2.0) + ((0.5 - (0.5 * cos((t_1 * 0.011111111111111112)))) * (b * b));
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = ((b * Math.PI) * Math.abs(angle)) * 0.005555555555555556;
	double t_1 = Math.abs(angle) * Math.PI;
	double tmp;
	if (Math.abs(angle) <= 350.0) {
		tmp = (((Math.cos((-0.011111111111111112 * t_1)) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	} else {
		tmp = Math.pow(a, 2.0) + ((0.5 - (0.5 * Math.cos((t_1 * 0.011111111111111112)))) * (b * b));
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = ((b * math.pi) * math.fabs(angle)) * 0.005555555555555556
	t_1 = math.fabs(angle) * math.pi
	tmp = 0
	if math.fabs(angle) <= 350.0:
		tmp = (((math.cos((-0.011111111111111112 * t_1)) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0)
	else:
		tmp = math.pow(a, 2.0) + ((0.5 - (0.5 * math.cos((t_1 * 0.011111111111111112)))) * (b * b))
	return tmp
function code(a, b, angle)
	t_0 = Float64(Float64(Float64(b * pi) * abs(angle)) * 0.005555555555555556)
	t_1 = Float64(abs(angle) * pi)
	tmp = 0.0
	if (abs(angle) <= 350.0)
		tmp = Float64(Float64(Float64(Float64(cos(Float64(-0.011111111111111112 * t_1)) + 1.0) * 0.5) * Float64(a * a)) + Float64(t_0 * t_0));
	else
		tmp = Float64((a ^ 2.0) + Float64(Float64(0.5 - Float64(0.5 * cos(Float64(t_1 * 0.011111111111111112)))) * Float64(b * b)));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = ((b * pi) * abs(angle)) * 0.005555555555555556;
	t_1 = abs(angle) * pi;
	tmp = 0.0;
	if (abs(angle) <= 350.0)
		tmp = (((cos((-0.011111111111111112 * t_1)) + 1.0) * 0.5) * (a * a)) + (t_0 * t_0);
	else
		tmp = (a ^ 2.0) + ((0.5 - (0.5 * cos((t_1 * 0.011111111111111112)))) * (b * b));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(N[(b * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * 1/180), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[N[Abs[angle], $MachinePrecision], 350], N[(N[(N[(N[(N[Cos[N[(-1/90 * t$95$1), $MachinePrecision]], $MachinePrecision] + 1), $MachinePrecision] * 1/2), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2], $MachinePrecision] + N[(N[(1/2 - N[(1/2 * N[Cos[N[(t$95$1 * 1/90), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(b \cdot \pi\right) \cdot \left|angle\right|\right) \cdot \frac{1}{180}\\
t_1 := \left|angle\right| \cdot \pi\\
\mathbf{if}\;\left|angle\right| \leq 350:\\
\;\;\;\;\left(\left(\cos \left(\frac{-1}{90} \cdot t\_1\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(t\_1 \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 350

    1. Initial program 80.4%

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
      3. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
      4. lower-PI.f6475.8%

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    4. Applied rewrites75.8%

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right)} \]

    if 350 < angle

    1. Initial program 80.4%

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

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

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

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)} \cdot \left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \]
      4. lift-*.f64N/A

        \[\leadsto {\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) \cdot \color{blue}{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)} \]
      5. swap-sqrN/A

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

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

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

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

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

        \[\leadsto {a}^{\color{blue}{2}} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right) \]
    6. Applied rewrites62.7%

      \[\leadsto \color{blue}{{a}^{2}} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 80.3% accurate, 1.4× speedup?

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

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

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

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

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

Alternative 9: 78.0% accurate, 1.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_0 \cdot t\_0\\


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

    1. Initial program 80.4%

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

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower--.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6425.6%

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    5. Applied rewrites25.6%

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    6. Applied rewrites25.6%

      \[\leadsto \color{blue}{\left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in a around inf

      \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \color{blue}{\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\color{blue}{\frac{1}{2}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower-+.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6457.2%

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    9. Applied rewrites57.2%

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

    if 8.5000000000000005e-85 < b

    1. Initial program 80.4%

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
      3. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
      4. lower-PI.f6475.8%

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    4. Applied rewrites75.8%

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 77.8% accurate, 1.9× speedup?

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

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


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

    1. Initial program 80.4%

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

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower--.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6425.6%

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    5. Applied rewrites25.6%

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    6. Applied rewrites25.6%

      \[\leadsto \color{blue}{\left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in a around inf

      \[\leadsto \color{blue}{{a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \color{blue}{\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\color{blue}{\frac{1}{2}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower-+.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6457.2%

        \[\leadsto {a}^{2} \cdot \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    9. Applied rewrites57.2%

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

    if 8.5000000000000005e-85 < b

    1. Initial program 80.4%

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
      3. lower-*.f64N/A

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
      4. lower-PI.f6475.8%

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    4. Applied rewrites75.8%

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

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

        \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
    7. Recombined 2 regimes into one program.
    8. Add Preprocessing

    Alternative 11: 77.1% accurate, 0.7× speedup?

    \[\begin{array}{l} t_0 := \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\\ t_1 := \pi \cdot \frac{angle}{180}\\ t_2 := \left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\\ \mathbf{if}\;{\left(a \cdot \cos t\_1\right)}^{2} + {\left(b \cdot \sin t\_1\right)}^{2} \leq \frac{5890680864316837}{2945340432158418383223693624588738123559693482299075088767878449688292160397327779966295692450325070170031945807812908771881611572255401942922812303597144053805349165872996110766935565946816006053119311086960734516644260779498911850068592403100913453684334767056261910363295677456051671938422478104563288264146944}:\\ \;\;\;\;\left(\frac{1}{2} - \left(-\sin \left(\frac{-1}{2} \cdot \pi - t\_0\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\cos t\_0 + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_2 \cdot t\_2\\ \end{array} \]
    (FPCore (a b angle)
      :precision binary64
      (let* ((t_0 (* -1/90 (* angle PI)))
           (t_1 (* PI (/ angle 180)))
           (t_2 (* (* (* b PI) angle) 1/180)))
      (if (<=
           (+ (pow (* a (cos t_1)) 2) (pow (* b (sin t_1)) 2))
           5890680864316837/2945340432158418383223693624588738123559693482299075088767878449688292160397327779966295692450325070170031945807812908771881611572255401942922812303597144053805349165872996110766935565946816006053119311086960734516644260779498911850068592403100913453684334767056261910363295677456051671938422478104563288264146944)
        (* (- 1/2 (* (- (sin (- (* -1/2 PI) t_0))) 1/2)) (* b b))
        (+ (* (* (+ (cos t_0) 1) 1/2) (* a a)) (* t_2 t_2)))))
    double code(double a, double b, double angle) {
    	double t_0 = -0.011111111111111112 * (angle * ((double) M_PI));
    	double t_1 = ((double) M_PI) * (angle / 180.0);
    	double t_2 = ((b * ((double) M_PI)) * angle) * 0.005555555555555556;
    	double tmp;
    	if ((pow((a * cos(t_1)), 2.0) + pow((b * sin(t_1)), 2.0)) <= 2e-297) {
    		tmp = (0.5 - (-sin(((-0.5 * ((double) M_PI)) - t_0)) * 0.5)) * (b * b);
    	} else {
    		tmp = (((cos(t_0) + 1.0) * 0.5) * (a * a)) + (t_2 * t_2);
    	}
    	return tmp;
    }
    
    public static double code(double a, double b, double angle) {
    	double t_0 = -0.011111111111111112 * (angle * Math.PI);
    	double t_1 = Math.PI * (angle / 180.0);
    	double t_2 = ((b * Math.PI) * angle) * 0.005555555555555556;
    	double tmp;
    	if ((Math.pow((a * Math.cos(t_1)), 2.0) + Math.pow((b * Math.sin(t_1)), 2.0)) <= 2e-297) {
    		tmp = (0.5 - (-Math.sin(((-0.5 * Math.PI) - t_0)) * 0.5)) * (b * b);
    	} else {
    		tmp = (((Math.cos(t_0) + 1.0) * 0.5) * (a * a)) + (t_2 * t_2);
    	}
    	return tmp;
    }
    
    def code(a, b, angle):
    	t_0 = -0.011111111111111112 * (angle * math.pi)
    	t_1 = math.pi * (angle / 180.0)
    	t_2 = ((b * math.pi) * angle) * 0.005555555555555556
    	tmp = 0
    	if (math.pow((a * math.cos(t_1)), 2.0) + math.pow((b * math.sin(t_1)), 2.0)) <= 2e-297:
    		tmp = (0.5 - (-math.sin(((-0.5 * math.pi) - t_0)) * 0.5)) * (b * b)
    	else:
    		tmp = (((math.cos(t_0) + 1.0) * 0.5) * (a * a)) + (t_2 * t_2)
    	return tmp
    
    function code(a, b, angle)
    	t_0 = Float64(-0.011111111111111112 * Float64(angle * pi))
    	t_1 = Float64(pi * Float64(angle / 180.0))
    	t_2 = Float64(Float64(Float64(b * pi) * angle) * 0.005555555555555556)
    	tmp = 0.0
    	if (Float64((Float64(a * cos(t_1)) ^ 2.0) + (Float64(b * sin(t_1)) ^ 2.0)) <= 2e-297)
    		tmp = Float64(Float64(0.5 - Float64(Float64(-sin(Float64(Float64(-0.5 * pi) - t_0))) * 0.5)) * Float64(b * b));
    	else
    		tmp = Float64(Float64(Float64(Float64(cos(t_0) + 1.0) * 0.5) * Float64(a * a)) + Float64(t_2 * t_2));
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, angle)
    	t_0 = -0.011111111111111112 * (angle * pi);
    	t_1 = pi * (angle / 180.0);
    	t_2 = ((b * pi) * angle) * 0.005555555555555556;
    	tmp = 0.0;
    	if ((((a * cos(t_1)) ^ 2.0) + ((b * sin(t_1)) ^ 2.0)) <= 2e-297)
    		tmp = (0.5 - (-sin(((-0.5 * pi) - t_0)) * 0.5)) * (b * b);
    	else
    		tmp = (((cos(t_0) + 1.0) * 0.5) * (a * a)) + (t_2 * t_2);
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, angle_] := Block[{t$95$0 = N[(-1/90 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle / 180), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(b * Pi), $MachinePrecision] * angle), $MachinePrecision] * 1/180), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision], 5890680864316837/2945340432158418383223693624588738123559693482299075088767878449688292160397327779966295692450325070170031945807812908771881611572255401942922812303597144053805349165872996110766935565946816006053119311086960734516644260779498911850068592403100913453684334767056261910363295677456051671938422478104563288264146944], N[(N[(1/2 - N[((-N[Sin[N[(N[(-1/2 * Pi), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]) * 1/2), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Cos[t$95$0], $MachinePrecision] + 1), $MachinePrecision] * 1/2), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    t_0 := \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\\
    t_1 := \pi \cdot \frac{angle}{180}\\
    t_2 := \left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\\
    \mathbf{if}\;{\left(a \cdot \cos t\_1\right)}^{2} + {\left(b \cdot \sin t\_1\right)}^{2} \leq \frac{5890680864316837}{2945340432158418383223693624588738123559693482299075088767878449688292160397327779966295692450325070170031945807812908771881611572255401942922812303597144053805349165872996110766935565946816006053119311086960734516644260779498911850068592403100913453684334767056261910363295677456051671938422478104563288264146944}:\\
    \;\;\;\;\left(\frac{1}{2} - \left(-\sin \left(\frac{-1}{2} \cdot \pi - t\_0\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(\left(\cos t\_0 + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + t\_2 \cdot t\_2\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 2.0000000000000001e-297

      1. Initial program 80.4%

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
      3. Taylor expanded in a around 0

        \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
      4. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto {b}^{2} \cdot \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
        2. lower-pow.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        3. lower--.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        4. lower-*.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
        5. lower-cos.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        6. lower-*.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        7. lower-*.f64N/A

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
        8. lower-PI.f6425.6%

          \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
      5. Applied rewrites25.6%

        \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
      6. Applied rewrites25.6%

        \[\leadsto \color{blue}{\left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)} \]
      7. Step-by-step derivation
        1. lift-cos.f64N/A

          \[\leadsto \left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        2. sin-+PI/2-revN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        3. lift-PI.f64N/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{\pi}{2}\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        4. mult-flipN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \pi \cdot \frac{1}{2}\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        5. metadata-evalN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \pi \cdot \frac{1}{2}\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        6. *-commutativeN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) + \frac{1}{2} \cdot \pi\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        7. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right) - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        8. sub-negate-revN/A

          \[\leadsto \left(\frac{1}{2} - \sin \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        9. sin-negN/A

          \[\leadsto \left(\frac{1}{2} - \left(\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        10. lower-neg.f64N/A

          \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        11. lower-sin.f64N/A

          \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        12. lower--.f64N/A

          \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        13. lower-*.f64N/A

          \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
        14. metadata-eval25.6%

          \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\frac{-1}{2} \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
      8. Applied rewrites25.6%

        \[\leadsto \left(\frac{1}{2} - \left(-\sin \left(\frac{-1}{2} \cdot \pi - \frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]

      if 2.0000000000000001e-297 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)))

      1. Initial program 80.4%

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

        \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\color{blue}{\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \left(b \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2} \]
        2. lower-*.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} \]
        3. lower-*.f64N/A

          \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} \]
        4. lower-PI.f6475.8%

          \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
      4. Applied rewrites75.8%

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

        \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) + 1\right) \cdot \frac{1}{2}\right) \cdot \left(a \cdot a\right) + \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \left(\left(\left(b \cdot \pi\right) \cdot angle\right) \cdot \frac{1}{180}\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 12: 25.9% accurate, 3.5× speedup?

    \[\left(\left(\frac{1}{2} - \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot b\right) \cdot b \]
    (FPCore (a b angle)
      :precision binary64
      (* (* (- 1/2 (* (cos (* 1/90 (* angle PI))) 1/2)) b) b))
    double code(double a, double b, double angle) {
    	return ((0.5 - (cos((0.011111111111111112 * (angle * ((double) M_PI)))) * 0.5)) * b) * b;
    }
    
    public static double code(double a, double b, double angle) {
    	return ((0.5 - (Math.cos((0.011111111111111112 * (angle * Math.PI))) * 0.5)) * b) * b;
    }
    
    def code(a, b, angle):
    	return ((0.5 - (math.cos((0.011111111111111112 * (angle * math.pi))) * 0.5)) * b) * b
    
    function code(a, b, angle)
    	return Float64(Float64(Float64(0.5 - Float64(cos(Float64(0.011111111111111112 * Float64(angle * pi))) * 0.5)) * b) * b)
    end
    
    function tmp = code(a, b, angle)
    	tmp = ((0.5 - (cos((0.011111111111111112 * (angle * pi))) * 0.5)) * b) * b;
    end
    
    code[a_, b_, angle_] := N[(N[(N[(1/2 - N[(N[Cos[N[(1/90 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]
    
    \left(\left(\frac{1}{2} - \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot b\right) \cdot b
    
    Derivation
    1. Initial program 80.4%

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

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower--.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6425.6%

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    5. Applied rewrites25.6%

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    6. Applied rewrites25.6%

      \[\leadsto \color{blue}{\left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)} \]
    7. Applied rewrites25.9%

      \[\leadsto \left(\left(\frac{1}{2} - \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot b\right) \cdot \color{blue}{b} \]
    8. Add Preprocessing

    Alternative 13: 10.6% accurate, 32.0× speedup?

    \[\left(\frac{1}{2} - \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
    (FPCore (a b angle)
      :precision binary64
      (* (- 1/2 1/2) (* b b)))
    double code(double a, double b, double angle) {
    	return (0.5 - 0.5) * (b * b);
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(a, b, angle)
    use fmin_fmax_functions
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: angle
        code = (0.5d0 - 0.5d0) * (b * b)
    end function
    
    public static double code(double a, double b, double angle) {
    	return (0.5 - 0.5) * (b * b);
    }
    
    def code(a, b, angle):
    	return (0.5 - 0.5) * (b * b)
    
    function code(a, b, angle)
    	return Float64(Float64(0.5 - 0.5) * Float64(b * b))
    end
    
    function tmp = code(a, b, angle)
    	tmp = (0.5 - 0.5) * (b * b);
    end
    
    code[a_, b_, angle_] := N[(N[(1/2 - 1/2), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]
    
    \left(\frac{1}{2} - \frac{1}{2}\right) \cdot \left(b \cdot b\right)
    
    Derivation
    1. Initial program 80.4%

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

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot b\right) \cdot b + \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(angle \cdot \pi\right) \cdot \frac{1}{90}\right)\right) \cdot a\right) \cdot a} \]
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower--.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      5. lower-cos.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. lower-PI.f6425.6%

        \[\leadsto {b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right) \]
    5. Applied rewrites25.6%

      \[\leadsto \color{blue}{{b}^{2} \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    6. Applied rewrites25.6%

      \[\leadsto \color{blue}{\left(\frac{1}{2} - \cos \left(\frac{-1}{90} \cdot \left(angle \cdot \pi\right)\right) \cdot \frac{1}{2}\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in angle around 0

      \[\leadsto \left(\frac{1}{2} - \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
    8. Step-by-step derivation
      1. Applied rewrites10.6%

        \[\leadsto \left(\frac{1}{2} - \frac{1}{2}\right) \cdot \left(b \cdot b\right) \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025285 -o generate:evaluate
      (FPCore (a b angle)
        :name "ab-angle->ABCF C"
        :precision binary64
        (+ (pow (* a (cos (* PI (/ angle 180)))) 2) (pow (* b (sin (* PI (/ angle 180)))) 2)))