ab-angle->ABCF C

Percentage Accurate: 78.9% → 78.8%
Time: 19.0s
Alternatives: 12
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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: 78.9% accurate, 1.0× speedup?

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

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

Alternative 1: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    12. lower-PI.f6476.5

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

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

Alternative 2: 44.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\mathbf{if}\;{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2} \leq 2 \cdot 10^{+305}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\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))) < 1.9999999999999999e305

    1. Initial program 64.5%

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

      \[\leadsto \color{blue}{{a}^{3}} \]
    4. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
      2. unpow2N/A

        \[\leadsto a \cdot \color{blue}{{a}^{2}} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{a \cdot {a}^{2}} \]
      4. unpow2N/A

        \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
      5. lower-*.f6418.1

        \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
    5. Simplified18.1%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
    6. Taylor expanded in a around inf

      \[\leadsto \color{blue}{{a}^{2}} \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6445.3

        \[\leadsto \color{blue}{a \cdot a} \]
    8. Simplified45.3%

      \[\leadsto \color{blue}{a \cdot a} \]

    if 1.9999999999999999e305 < (+.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 97.9%

      \[{\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. Add Preprocessing
    3. Taylor expanded in angle around 0

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left({angle}^{2} \cdot \left(\frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \cdot {a}^{2} + {a}^{2}\right) + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      6. distribute-lft1-inN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}, 1\right)} \cdot {a}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      9. unpow2N/A

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

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

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \color{blue}{\frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}}, 1\right) \cdot {a}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      12. unpow2N/A

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

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \frac{-1}{32400} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, 1\right) \cdot {a}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      14. lower-PI.f64N/A

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \frac{-1}{32400} \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), 1\right) \cdot {a}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      15. lower-PI.f64N/A

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \frac{-1}{32400} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), 1\right) \cdot {a}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      16. unpow2N/A

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \frac{-1}{32400} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), 1\right) \cdot \color{blue}{\left(a \cdot a\right)} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      17. lower-*.f6440.2

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, -3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), 1\right) \cdot \color{blue}{\left(a \cdot a\right)} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. Simplified40.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, -3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), 1\right) \cdot \left(a \cdot a\right)} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. Taylor expanded in angle around -inf

      \[\leadsto \color{blue}{\frac{1}{32400} \cdot \left({a}^{3} \cdot \left({angle}^{3} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{32400} \cdot {a}^{3}\right) \cdot \left({angle}^{3} \cdot {\mathsf{PI}\left(\right)}^{3}\right)} \]
      2. *-commutativeN/A

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

        \[\leadsto \color{blue}{\left({angle}^{3} \cdot {\mathsf{PI}\left(\right)}^{3}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right)} \]
      4. unpow3N/A

        \[\leadsto \left(\color{blue}{\left(\left(angle \cdot angle\right) \cdot angle\right)} \cdot {\mathsf{PI}\left(\right)}^{3}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      5. unpow2N/A

        \[\leadsto \left(\left(\color{blue}{{angle}^{2}} \cdot angle\right) \cdot {\mathsf{PI}\left(\right)}^{3}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      6. associate-*l*N/A

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

        \[\leadsto \color{blue}{\left({angle}^{2} \cdot \left(angle \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)} \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\color{blue}{\left(angle \cdot angle\right)} \cdot \left(angle \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(angle \cdot angle\right)} \cdot \left(angle \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \color{blue}{\left(angle \cdot {\mathsf{PI}\left(\right)}^{3}\right)}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      11. cube-multN/A

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      12. unpow2N/A

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

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

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      15. unpow2N/A

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      16. lower-*.f64N/A

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

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

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)\right) \cdot \left(\frac{1}{32400} \cdot {a}^{3}\right) \]
      19. *-commutativeN/A

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot \color{blue}{\left({a}^{3} \cdot \frac{1}{32400}\right)} \]
      20. lower-*.f64N/A

        \[\leadsto \left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot \color{blue}{\left({a}^{3} \cdot \frac{1}{32400}\right)} \]
    8. Simplified29.5%

      \[\leadsto \color{blue}{\left(\left(angle \cdot angle\right) \cdot \left(angle \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)\right)\right) \cdot \left(\left(a \cdot \left(a \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} \]
    9. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\left(a \cdot \left(a \cdot a\right)\right) \cdot \frac{1}{32400}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\left(a \cdot \left(a \cdot a\right)\right) \cdot \frac{1}{32400}\right) \]
      2. lower-PI.f6438.4

        \[\leadsto \left(angle \cdot \color{blue}{\pi}\right) \cdot \left(\left(a \cdot \left(a \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \]
    11. Simplified38.4%

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

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

Alternative 3: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    9. lower-PI.f6476.5

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

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

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

Alternative 4: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    12. lower-PI.f6476.5

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \color{blue}{\frac{1}{180}}\right)\right)}^{2} \]
    6. lower-*.f6476.5

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{180}\right)\right)}^{2} \]
    9. lift-*.f6476.5

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

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

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

Alternative 5: 78.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\\ \mathsf{fma}\left(t\_0, t\_0, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right) \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* b (sin (* angle (* 0.005555555555555556 PI))))))
   (fma
    t_0
    t_0
    (* (* a a) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5)))))
double code(double a, double b, double angle) {
	double t_0 = b * sin((angle * (0.005555555555555556 * ((double) M_PI))));
	return fma(t_0, t_0, ((a * a) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
}
function code(a, b, angle)
	t_0 = Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi))))
	return fma(t_0, t_0, Float64(Float64(a * a) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5)))
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(b * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0 + N[(N[(a * a), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\\
\mathsf{fma}\left(t\_0, t\_0, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    12. lower-PI.f6476.5

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right), b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right), \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
  7. Final simplification76.4%

    \[\leadsto \mathsf{fma}\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right), b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right), \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right) \]
  8. Add Preprocessing

Alternative 6: 78.9% accurate, 1.9× speedup?

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

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

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

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

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. lower-*.f6475.7

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

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

Alternative 7: 75.5% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\\ \mathbf{if}\;\frac{angle}{180} \leq 500000:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, t\_0, 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(t\_0, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (cos (* (* angle PI) 0.011111111111111112))))
   (if (<= (/ angle 180.0) 500000.0)
     (fma
      (* angle (* angle (* b (* (* PI PI) 3.08641975308642e-5))))
      b
      (* (* a a) (fma 0.5 t_0 0.5)))
     (fma (* b (fma t_0 -0.5 0.5)) b (* (* a a) (fma 0.5 1.0 0.5))))))
double code(double a, double b, double angle) {
	double t_0 = cos(((angle * ((double) M_PI)) * 0.011111111111111112));
	double tmp;
	if ((angle / 180.0) <= 500000.0) {
		tmp = fma((angle * (angle * (b * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5)))), b, ((a * a) * fma(0.5, t_0, 0.5)));
	} else {
		tmp = fma((b * fma(t_0, -0.5, 0.5)), b, ((a * a) * fma(0.5, 1.0, 0.5)));
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = cos(Float64(Float64(angle * pi) * 0.011111111111111112))
	tmp = 0.0
	if (Float64(angle / 180.0) <= 500000.0)
		tmp = fma(Float64(angle * Float64(angle * Float64(b * Float64(Float64(pi * pi) * 3.08641975308642e-5)))), b, Float64(Float64(a * a) * fma(0.5, t_0, 0.5)));
	else
		tmp = fma(Float64(b * fma(t_0, -0.5, 0.5)), b, Float64(Float64(a * a) * fma(0.5, 1.0, 0.5)));
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 500000.0], N[(N[(angle * N[(angle * N[(b * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 * t$95$0 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(t$95$0 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 * 1.0 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\\
\mathbf{if}\;\frac{angle}{180} \leq 500000:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, t\_0, 0.5\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(t\_0, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle #s(literal 180 binary64)) < 5e5

    1. Initial program 82.8%

      \[{\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. Add Preprocessing
    3. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      12. lower-PI.f6482.9

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{180} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}}\right)\right)}^{2} \]
      10. lower-/.f6482.8

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
    9. Taylor expanded in angle around 0

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{32400} \cdot \left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left({angle}^{2} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) \cdot \frac{1}{32400}}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{{angle}^{2} \cdot \left(\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \frac{1}{32400}\right)}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left({angle}^{2} \cdot \color{blue}{\left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(angle \cdot angle\right)} \cdot \left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      5. associate-*l*N/A

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

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

        \[\leadsto \mathsf{fma}\left(angle \cdot \color{blue}{\left(angle \cdot \left(\frac{1}{32400} \cdot \left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right)}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \color{blue}{\left(\left(b \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \frac{1}{32400}\right)}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot \frac{1}{32400}\right)\right)}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      10. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\frac{1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      12. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{2} \cdot \frac{1}{32400}\right)}\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      14. unpow2N/A

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

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

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      17. lower-PI.f6478.4

        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right) \]
    11. Simplified78.4%

      \[\leadsto \mathsf{fma}\left(\color{blue}{angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)}, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right) \]

    if 5e5 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 59.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
      12. lower-PI.f6459.7

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{180} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}}\right)\right)}^{2} \]
      10. lower-/.f6459.7

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
    9. Taylor expanded in angle around 0

      \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{-1}{2}, \frac{1}{2}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \color{blue}{1}, \frac{1}{2}\right)\right) \]
    10. Step-by-step derivation
      1. Simplified59.5%

        \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \color{blue}{1}, 0.5\right)\right) \]
    11. Recombined 2 regimes into one program.
    12. Final simplification73.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 500000:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right)\\ \end{array} \]
    13. Add Preprocessing

    Alternative 8: 57.4% accurate, 3.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.05 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(1, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)\\ \end{array} \end{array} \]
    (FPCore (a b angle)
     :precision binary64
     (if (<= b 1.05e+139)
       (fma
        (* b (fma 1.0 -0.5 0.5))
        b
        (* (* a a) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5)))
       (*
        (* b (* b b))
        (fma (cos (* angle (* PI 0.011111111111111112))) -0.5 0.5))))
    double code(double a, double b, double angle) {
    	double tmp;
    	if (b <= 1.05e+139) {
    		tmp = fma((b * fma(1.0, -0.5, 0.5)), b, ((a * a) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
    	} else {
    		tmp = (b * (b * b)) * fma(cos((angle * (((double) M_PI) * 0.011111111111111112))), -0.5, 0.5);
    	}
    	return tmp;
    }
    
    function code(a, b, angle)
    	tmp = 0.0
    	if (b <= 1.05e+139)
    		tmp = fma(Float64(b * fma(1.0, -0.5, 0.5)), b, Float64(Float64(a * a) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5)));
    	else
    		tmp = Float64(Float64(b * Float64(b * b)) * fma(cos(Float64(angle * Float64(pi * 0.011111111111111112))), -0.5, 0.5));
    	end
    	return tmp
    end
    
    code[a_, b_, angle_] := If[LessEqual[b, 1.05e+139], N[(N[(b * N[(1.0 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 1.05 \cdot 10^{+139}:\\
    \;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(1, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 1.0499999999999999e139

      1. Initial program 73.8%

        \[{\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. Add Preprocessing
      3. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{180} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}}\right)\right)}^{2} \]
        10. lower-/.f6473.8

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
      9. Taylor expanded in angle around 0

        \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\color{blue}{1}, \frac{-1}{2}, \frac{1}{2}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{1}{2}\right)\right) \]
      10. Step-by-step derivation
        1. Simplified55.7%

          \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\color{blue}{1}, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right) \]

        if 1.0499999999999999e139 < b

        1. Initial program 96.6%

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(a \cdot a\right)\right)}, \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right), b \cdot \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
        4. Taylor expanded in a around 0

          \[\leadsto \color{blue}{{b}^{3} \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)} \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{{b}^{3} \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)} \]
          2. cube-multN/A

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \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) \]
          3. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{{b}^{2}}\right) \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) \]
          4. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot {b}^{2}\right)} \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) \]
          5. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \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 \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \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. sub-negN/A

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)} \]
          8. +-commutativeN/A

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

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{1}{2}}\right)\right) + \frac{1}{2}\right) \]
          10. distribute-rgt-neg-inN/A

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

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

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
          13. *-commutativeN/A

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{90}\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
          14. associate-*l*N/A

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

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

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

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{1}{90}\right)\right), \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
          18. metadata-eval63.9

            \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), \color{blue}{-0.5}, 0.5\right) \]
        6. Simplified63.9%

          \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)} \]
      11. Recombined 2 regimes into one program.
      12. Final simplification56.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.05 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot \mathsf{fma}\left(1, -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)\\ \end{array} \]
      13. Add Preprocessing

      Alternative 9: 67.0% accurate, 3.1× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right) \end{array} \]
      (FPCore (a b angle)
       :precision binary64
       (fma
        (* b (fma (cos (* (* angle PI) 0.011111111111111112)) -0.5 0.5))
        b
        (* (* a a) (fma 0.5 1.0 0.5))))
      double code(double a, double b, double angle) {
      	return fma((b * fma(cos(((angle * ((double) M_PI)) * 0.011111111111111112)), -0.5, 0.5)), b, ((a * a) * fma(0.5, 1.0, 0.5)));
      }
      
      function code(a, b, angle)
      	return fma(Float64(b * fma(cos(Float64(Float64(angle * pi) * 0.011111111111111112)), -0.5, 0.5)), b, Float64(Float64(a * a) * fma(0.5, 1.0, 0.5)))
      end
      
      code[a_, b_, angle_] := N[(N[(b * N[(N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 * 1.0 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
        12. lower-PI.f6476.5

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
      9. Taylor expanded in angle around 0

        \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right), \frac{-1}{2}, \frac{1}{2}\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \color{blue}{1}, \frac{1}{2}\right)\right) \]
      10. Step-by-step derivation
        1. Simplified64.8%

          \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \color{blue}{1}, 0.5\right)\right) \]
        2. Final simplification64.8%

          \[\leadsto \mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, 1, 0.5\right)\right) \]
        3. Add Preprocessing

        Alternative 10: 57.6% accurate, 3.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.05 \cdot 10^{+139}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)\\ \end{array} \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (if (<= b 1.05e+139)
           (* a a)
           (*
            (* b (* b b))
            (fma (cos (* angle (* PI 0.011111111111111112))) -0.5 0.5))))
        double code(double a, double b, double angle) {
        	double tmp;
        	if (b <= 1.05e+139) {
        		tmp = a * a;
        	} else {
        		tmp = (b * (b * b)) * fma(cos((angle * (((double) M_PI) * 0.011111111111111112))), -0.5, 0.5);
        	}
        	return tmp;
        }
        
        function code(a, b, angle)
        	tmp = 0.0
        	if (b <= 1.05e+139)
        		tmp = Float64(a * a);
        	else
        		tmp = Float64(Float64(b * Float64(b * b)) * fma(cos(Float64(angle * Float64(pi * 0.011111111111111112))), -0.5, 0.5));
        	end
        	return tmp
        end
        
        code[a_, b_, angle_] := If[LessEqual[b, 1.05e+139], N[(a * a), $MachinePrecision], N[(N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 1.05 \cdot 10^{+139}:\\
        \;\;\;\;a \cdot a\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 1.0499999999999999e139

          1. Initial program 73.8%

            \[{\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. Add Preprocessing
          3. Taylor expanded in angle around 0

            \[\leadsto \color{blue}{{a}^{3}} \]
          4. Step-by-step derivation
            1. cube-multN/A

              \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
            2. unpow2N/A

              \[\leadsto a \cdot \color{blue}{{a}^{2}} \]
            3. lower-*.f64N/A

              \[\leadsto \color{blue}{a \cdot {a}^{2}} \]
            4. unpow2N/A

              \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
            5. lower-*.f6427.9

              \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
          5. Simplified27.9%

            \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
          6. Taylor expanded in a around inf

            \[\leadsto \color{blue}{{a}^{2}} \]
          7. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \color{blue}{a \cdot a} \]
            2. lower-*.f6455.2

              \[\leadsto \color{blue}{a \cdot a} \]
          8. Simplified55.2%

            \[\leadsto \color{blue}{a \cdot a} \]

          if 1.0499999999999999e139 < b

          1. Initial program 96.6%

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(a \cdot a\right)\right)}, \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right), b \cdot \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)} \]
          4. Taylor expanded in a around 0

            \[\leadsto \color{blue}{{b}^{3} \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)} \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \color{blue}{{b}^{3} \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)} \]
            2. cube-multN/A

              \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \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) \]
            3. unpow2N/A

              \[\leadsto \left(b \cdot \color{blue}{{b}^{2}}\right) \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) \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(b \cdot {b}^{2}\right)} \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) \]
            5. unpow2N/A

              \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \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 \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \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. sub-negN/A

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right)} \]
            8. +-commutativeN/A

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

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{1}{2}}\right)\right) + \frac{1}{2}\right) \]
            10. distribute-rgt-neg-inN/A

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

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

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
            13. *-commutativeN/A

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{90}\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
            14. associate-*l*N/A

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

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

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

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{1}{90}\right)\right), \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \]
            18. metadata-eval63.9

              \[\leadsto \left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), \color{blue}{-0.5}, 0.5\right) \]
          6. Simplified63.9%

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right)} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 11: 56.8% accurate, 6.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 5.2 \cdot 10^{+257}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a \cdot \left(a \cdot a\right), -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (if (<= b 5.2e+257)
           (* a a)
           (fma
            a
            (* a a)
            (*
             (* angle angle)
             (*
              (* PI PI)
              (fma
               (* a (* a a))
               -3.08641975308642e-5
               (* 3.08641975308642e-5 (* b (* b b)))))))))
        double code(double a, double b, double angle) {
        	double tmp;
        	if (b <= 5.2e+257) {
        		tmp = a * a;
        	} else {
        		tmp = fma(a, (a * a), ((angle * angle) * ((((double) M_PI) * ((double) M_PI)) * fma((a * (a * a)), -3.08641975308642e-5, (3.08641975308642e-5 * (b * (b * b)))))));
        	}
        	return tmp;
        }
        
        function code(a, b, angle)
        	tmp = 0.0
        	if (b <= 5.2e+257)
        		tmp = Float64(a * a);
        	else
        		tmp = fma(a, Float64(a * a), Float64(Float64(angle * angle) * Float64(Float64(pi * pi) * fma(Float64(a * Float64(a * a)), -3.08641975308642e-5, Float64(3.08641975308642e-5 * Float64(b * Float64(b * b)))))));
        	end
        	return tmp
        end
        
        code[a_, b_, angle_] := If[LessEqual[b, 5.2e+257], N[(a * a), $MachinePrecision], N[(a * N[(a * a), $MachinePrecision] + N[(N[(angle * angle), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision] * -3.08641975308642e-5 + N[(3.08641975308642e-5 * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 5.2 \cdot 10^{+257}:\\
        \;\;\;\;a \cdot a\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a \cdot \left(a \cdot a\right), -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 5.20000000000000042e257

          1. Initial program 75.6%

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

            \[\leadsto \color{blue}{{a}^{3}} \]
          4. Step-by-step derivation
            1. cube-multN/A

              \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
            2. unpow2N/A

              \[\leadsto a \cdot \color{blue}{{a}^{2}} \]
            3. lower-*.f64N/A

              \[\leadsto \color{blue}{a \cdot {a}^{2}} \]
            4. unpow2N/A

              \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
            5. lower-*.f6426.7

              \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
          5. Simplified26.7%

            \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
          6. Taylor expanded in a around inf

            \[\leadsto \color{blue}{{a}^{2}} \]
          7. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \color{blue}{a \cdot a} \]
            2. lower-*.f6455.5

              \[\leadsto \color{blue}{a \cdot a} \]
          8. Simplified55.5%

            \[\leadsto \color{blue}{a \cdot a} \]

          if 5.20000000000000042e257 < b

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
            12. lower-PI.f64100.0

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(a \cdot a\right) \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{1}{180} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}}\right)\right)}^{2} \]
            10. lower-/.f6499.7

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), 0.5\right)\right)} \]
          9. Taylor expanded in angle around 0

            \[\leadsto \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{3}} \]
          10. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{{a}^{3} + {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
            2. cube-multN/A

              \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} + {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) \]
            3. unpow2N/A

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(a, {a}^{2}, {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right)} \]
            5. unpow2N/A

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

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

              \[\leadsto \mathsf{fma}\left(a, a \cdot a, \color{blue}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}\right) \]
            8. unpow2N/A

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

              \[\leadsto \mathsf{fma}\left(a, a \cdot a, \color{blue}{\left(angle \cdot angle\right)} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \]
            10. associate-*r*N/A

              \[\leadsto \mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \left(\color{blue}{\left(\frac{-1}{32400} \cdot {a}^{3}\right) \cdot {\mathsf{PI}\left(\right)}^{2}} + \frac{1}{32400} \cdot \left({b}^{3} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \]
            11. associate-*r*N/A

              \[\leadsto \mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \left(\left(\frac{-1}{32400} \cdot {a}^{3}\right) \cdot {\mathsf{PI}\left(\right)}^{2} + \color{blue}{\left(\frac{1}{32400} \cdot {b}^{3}\right) \cdot {\mathsf{PI}\left(\right)}^{2}}\right)\right) \]
            12. distribute-rgt-outN/A

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

              \[\leadsto \mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{2} \cdot \left(\frac{-1}{32400} \cdot {a}^{3} + \frac{1}{32400} \cdot {b}^{3}\right)\right)}\right) \]
          11. Simplified55.6%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 5.2 \cdot 10^{+257}:\\ \;\;\;\;a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, a \cdot a, \left(angle \cdot angle\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(a \cdot \left(a \cdot a\right), -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 12: 55.9% accurate, 74.7× speedup?

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

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

          \[\leadsto \color{blue}{{a}^{3}} \]
        4. Step-by-step derivation
          1. cube-multN/A

            \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
          2. unpow2N/A

            \[\leadsto a \cdot \color{blue}{{a}^{2}} \]
          3. lower-*.f64N/A

            \[\leadsto \color{blue}{a \cdot {a}^{2}} \]
          4. unpow2N/A

            \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
          5. lower-*.f6426.7

            \[\leadsto a \cdot \color{blue}{\left(a \cdot a\right)} \]
        5. Simplified26.7%

          \[\leadsto \color{blue}{a \cdot \left(a \cdot a\right)} \]
        6. Taylor expanded in a around inf

          \[\leadsto \color{blue}{{a}^{2}} \]
        7. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto \color{blue}{a \cdot a} \]
          2. lower-*.f6454.8

            \[\leadsto \color{blue}{a \cdot a} \]
        8. Simplified54.8%

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

        Reproduce

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