ab-angle->ABCF A

Percentage Accurate: 79.5% → 79.5%
Time: 17.2s
Alternatives: 12
Speedup: 2.5×

Specification

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

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos 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: 79.5% accurate, 1.0× speedup?

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

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

Alternative 1: 79.5% accurate, 2.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\


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

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000024e-5 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 79.4% accurate, 0.6× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\sqrt[3]{\pi} \cdot \left(\sqrt[3]{\pi} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (+
      (pow (* a (sin (* (/ angle_m 180.0) PI))) 2.0)
      (pow
       (*
        b
        (cos
         (*
          (cbrt PI)
          (* (cbrt PI) (* (cbrt PI) (* angle_m 0.005555555555555556))))))
       2.0)))
    angle_m = fabs(angle);
    double code(double a, double b, double angle_m) {
    	return pow((a * sin(((angle_m / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((cbrt(((double) M_PI)) * (cbrt(((double) M_PI)) * (cbrt(((double) M_PI)) * (angle_m * 0.005555555555555556)))))), 2.0);
    }
    
    angle_m = Math.abs(angle);
    public static double code(double a, double b, double angle_m) {
    	return Math.pow((a * Math.sin(((angle_m / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((Math.cbrt(Math.PI) * (Math.cbrt(Math.PI) * (Math.cbrt(Math.PI) * (angle_m * 0.005555555555555556)))))), 2.0);
    }
    
    angle_m = abs(angle)
    function code(a, b, angle_m)
    	return Float64((Float64(a * sin(Float64(Float64(angle_m / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(cbrt(pi) * Float64(cbrt(pi) * Float64(cbrt(pi) * Float64(angle_m * 0.005555555555555556)))))) ^ 2.0))
    end
    
    angle_m = N[Abs[angle], $MachinePrecision]
    code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\sqrt[3]{\pi} \cdot \left(\sqrt[3]{\pi} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
    \end{array}
    
    Derivation
    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 79.5% accurate, 1.9× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \sin \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle\_m}}\right)\right)}^{2} + b \cdot b \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (+
      (pow (* a (sin (* 0.005555555555555556 (/ PI (/ 1.0 angle_m))))) 2.0)
      (* b b)))
    angle_m = fabs(angle);
    double code(double a, double b, double angle_m) {
    	return pow((a * sin((0.005555555555555556 * (((double) M_PI) / (1.0 / angle_m))))), 2.0) + (b * b);
    }
    
    angle_m = Math.abs(angle);
    public static double code(double a, double b, double angle_m) {
    	return Math.pow((a * Math.sin((0.005555555555555556 * (Math.PI / (1.0 / angle_m))))), 2.0) + (b * b);
    }
    
    angle_m = math.fabs(angle)
    def code(a, b, angle_m):
    	return math.pow((a * math.sin((0.005555555555555556 * (math.pi / (1.0 / angle_m))))), 2.0) + (b * b)
    
    angle_m = abs(angle)
    function code(a, b, angle_m)
    	return Float64((Float64(a * sin(Float64(0.005555555555555556 * Float64(pi / Float64(1.0 / angle_m))))) ^ 2.0) + Float64(b * b))
    end
    
    angle_m = abs(angle);
    function tmp = code(a, b, angle_m)
    	tmp = ((a * sin((0.005555555555555556 * (pi / (1.0 / angle_m))))) ^ 2.0) + (b * b);
    end
    
    angle_m = N[Abs[angle], $MachinePrecision]
    code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(Pi / N[(1.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    {\left(a \cdot \sin \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle\_m}}\right)\right)}^{2} + b \cdot b
    \end{array}
    
    Derivation
    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 79.5% accurate, 1.9× speedup?

      \[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\right)}^{2} + b \cdot b \end{array} \]
      angle_m = (fabs.f64 angle)
      (FPCore (a b angle_m)
       :precision binary64
       (+ (pow (* a (sin (* (/ angle_m 180.0) PI))) 2.0) (* b b)))
      angle_m = fabs(angle);
      double code(double a, double b, double angle_m) {
      	return pow((a * sin(((angle_m / 180.0) * ((double) M_PI)))), 2.0) + (b * b);
      }
      
      angle_m = Math.abs(angle);
      public static double code(double a, double b, double angle_m) {
      	return Math.pow((a * Math.sin(((angle_m / 180.0) * Math.PI))), 2.0) + (b * b);
      }
      
      angle_m = math.fabs(angle)
      def code(a, b, angle_m):
      	return math.pow((a * math.sin(((angle_m / 180.0) * math.pi))), 2.0) + (b * b)
      
      angle_m = abs(angle)
      function code(a, b, angle_m)
      	return Float64((Float64(a * sin(Float64(Float64(angle_m / 180.0) * pi))) ^ 2.0) + Float64(b * b))
      end
      
      angle_m = abs(angle);
      function tmp = code(a, b, angle_m)
      	tmp = ((a * sin(((angle_m / 180.0) * pi))) ^ 2.0) + (b * b);
      end
      
      angle_m = N[Abs[angle], $MachinePrecision]
      code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      angle_m = \left|angle\right|
      
      \\
      {\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\right)}^{2} + b \cdot b
      \end{array}
      
      Derivation
      1. Initial program 78.5%

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

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

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

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

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

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

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

        Alternative 5: 72.5% accurate, 2.5× speedup?

        \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\ \end{array} \end{array} \]
        angle_m = (fabs.f64 angle)
        (FPCore (a b angle_m)
         :precision binary64
         (if (<= (/ angle_m 180.0) 4e-148)
           (* b b)
           (if (<= (/ angle_m 180.0) 3e-25)
             (fma
              (* angle_m (* angle_m (* PI PI)))
              (* 3.08641975308642e-5 (* a a))
              (* b b))
             (fma
              (* a (fma (cos (* angle_m (* PI 0.011111111111111112))) -0.5 0.5))
              a
              (* (* b b) (* 1.0 1.0))))))
        angle_m = fabs(angle);
        double code(double a, double b, double angle_m) {
        	double tmp;
        	if ((angle_m / 180.0) <= 4e-148) {
        		tmp = b * b;
        	} else if ((angle_m / 180.0) <= 3e-25) {
        		tmp = fma((angle_m * (angle_m * (((double) M_PI) * ((double) M_PI)))), (3.08641975308642e-5 * (a * a)), (b * b));
        	} else {
        		tmp = fma((a * fma(cos((angle_m * (((double) M_PI) * 0.011111111111111112))), -0.5, 0.5)), a, ((b * b) * (1.0 * 1.0)));
        	}
        	return tmp;
        }
        
        angle_m = abs(angle)
        function code(a, b, angle_m)
        	tmp = 0.0
        	if (Float64(angle_m / 180.0) <= 4e-148)
        		tmp = Float64(b * b);
        	elseif (Float64(angle_m / 180.0) <= 3e-25)
        		tmp = fma(Float64(angle_m * Float64(angle_m * Float64(pi * pi))), Float64(3.08641975308642e-5 * Float64(a * a)), Float64(b * b));
        	else
        		tmp = fma(Float64(a * fma(cos(Float64(angle_m * Float64(pi * 0.011111111111111112))), -0.5, 0.5)), a, Float64(Float64(b * b) * Float64(1.0 * 1.0)));
        	end
        	return tmp
        end
        
        angle_m = N[Abs[angle], $MachinePrecision]
        code[a_, b_, angle$95$m_] := If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e-148], N[(b * b), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 3e-25], N[(N[(angle$95$m * N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Cos[N[(angle$95$m * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * a + N[(N[(b * b), $MachinePrecision] * N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        angle_m = \left|angle\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
        \;\;\;\;b \cdot b\\
        
        \mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{-25}:\\
        \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle\_m \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(1 \cdot 1\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148

          1. Initial program 84.5%

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

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

              \[\leadsto \color{blue}{b \cdot b} \]
            2. lower-*.f6467.3

              \[\leadsto \color{blue}{b \cdot b} \]
          5. Applied rewrites67.3%

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

          if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 2.9999999999999998e-25

          1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
          5. Applied rewrites67.9%

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

            \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{32400} \cdot \color{blue}{{a}^{2}}, b \cdot b\right) \]
          7. Step-by-step derivation
            1. Applied rewrites96.5%

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

            if 2.9999999999999998e-25 < (/.f64 angle #s(literal 180 binary64))

            1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 6: 73.2% accurate, 2.6× speedup?

            \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot 0.5, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \pi\right)\right), -0.5, 0.5\right)\right)\\ \end{array} \end{array} \]
            angle_m = (fabs.f64 angle)
            (FPCore (a b angle_m)
             :precision binary64
             (if (<= (/ angle_m 180.0) 4e-148)
               (* b b)
               (if (<= (/ angle_m 180.0) 5e-5)
                 (fma
                  (* angle_m (* angle_m (* PI PI)))
                  (* 3.08641975308642e-5 (* a a))
                  (* b b))
                 (fma
                  (* b 0.5)
                  b
                  (*
                   (* a a)
                   (fma (cos (* 0.011111111111111112 (* angle_m PI))) -0.5 0.5))))))
            angle_m = fabs(angle);
            double code(double a, double b, double angle_m) {
            	double tmp;
            	if ((angle_m / 180.0) <= 4e-148) {
            		tmp = b * b;
            	} else if ((angle_m / 180.0) <= 5e-5) {
            		tmp = fma((angle_m * (angle_m * (((double) M_PI) * ((double) M_PI)))), (3.08641975308642e-5 * (a * a)), (b * b));
            	} else {
            		tmp = fma((b * 0.5), b, ((a * a) * fma(cos((0.011111111111111112 * (angle_m * ((double) M_PI)))), -0.5, 0.5)));
            	}
            	return tmp;
            }
            
            angle_m = abs(angle)
            function code(a, b, angle_m)
            	tmp = 0.0
            	if (Float64(angle_m / 180.0) <= 4e-148)
            		tmp = Float64(b * b);
            	elseif (Float64(angle_m / 180.0) <= 5e-5)
            		tmp = fma(Float64(angle_m * Float64(angle_m * Float64(pi * pi))), Float64(3.08641975308642e-5 * Float64(a * a)), Float64(b * b));
            	else
            		tmp = fma(Float64(b * 0.5), b, Float64(Float64(a * a) * fma(cos(Float64(0.011111111111111112 * Float64(angle_m * pi))), -0.5, 0.5)));
            	end
            	return tmp
            end
            
            angle_m = N[Abs[angle], $MachinePrecision]
            code[a_, b_, angle$95$m_] := If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e-148], N[(b * b), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e-5], N[(N[(angle$95$m * N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(b * 0.5), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(N[Cos[N[(0.011111111111111112 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
            
            \begin{array}{l}
            angle_m = \left|angle\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
            \;\;\;\;b \cdot b\\
            
            \mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{-5}:\\
            \;\;\;\;\mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(b \cdot 0.5, b, \left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \pi\right)\right), -0.5, 0.5\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148

              1. Initial program 84.5%

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

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

                  \[\leadsto \color{blue}{b \cdot b} \]
                2. lower-*.f6467.3

                  \[\leadsto \color{blue}{b \cdot b} \]
              5. Applied rewrites67.3%

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

              if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 5.00000000000000024e-5

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
              5. Applied rewrites66.7%

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

                \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{32400} \cdot \color{blue}{{a}^{2}}, b \cdot b\right) \]
              7. Step-by-step derivation
                1. Applied rewrites95.8%

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

                if 5.00000000000000024e-5 < (/.f64 angle #s(literal 180 binary64))

                1. Initial program 58.2%

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

                  \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(a \cdot a, 0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right), \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)\right)\right)}}} \]
                4. Applied rewrites41.2%

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

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

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \color{blue}{\left(a \cdot a\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)\right) \]
                  3. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot b, b, \color{blue}{\left(a \cdot a\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)\right) \]
                  4. +-commutativeN/A

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(0.5 \cdot b, b, \color{blue}{\left(a \cdot a\right) \cdot \mathsf{fma}\left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right)}\right) \]
              8. Recombined 3 regimes into one program.
              9. Final simplification68.4%

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

              Alternative 7: 59.8% accurate, 3.4× speedup?

              \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot \left(\pi \cdot \pi\right)\right) \cdot \mathsf{fma}\left(b, b \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right), angle\_m, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \pi\right)\right), 0.5\right)\\ \end{array} \end{array} \]
              angle_m = (fabs.f64 angle)
              (FPCore (a b angle_m)
               :precision binary64
               (if (<= b 2.1e+63)
                 (fma
                  (*
                   (* angle_m (* PI PI))
                   (fma b (* b -3.08641975308642e-5) (* 3.08641975308642e-5 (* a a))))
                  angle_m
                  (* b b))
                 (* (* b b) (fma 0.5 (cos (* 0.011111111111111112 (* angle_m PI))) 0.5))))
              angle_m = fabs(angle);
              double code(double a, double b, double angle_m) {
              	double tmp;
              	if (b <= 2.1e+63) {
              		tmp = fma(((angle_m * (((double) M_PI) * ((double) M_PI))) * fma(b, (b * -3.08641975308642e-5), (3.08641975308642e-5 * (a * a)))), angle_m, (b * b));
              	} else {
              		tmp = (b * b) * fma(0.5, cos((0.011111111111111112 * (angle_m * ((double) M_PI)))), 0.5);
              	}
              	return tmp;
              }
              
              angle_m = abs(angle)
              function code(a, b, angle_m)
              	tmp = 0.0
              	if (b <= 2.1e+63)
              		tmp = fma(Float64(Float64(angle_m * Float64(pi * pi)) * fma(b, Float64(b * -3.08641975308642e-5), Float64(3.08641975308642e-5 * Float64(a * a)))), angle_m, Float64(b * b));
              	else
              		tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(0.011111111111111112 * Float64(angle_m * pi))), 0.5));
              	end
              	return tmp
              end
              
              angle_m = N[Abs[angle], $MachinePrecision]
              code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.1e+63], N[(N[(N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(b * N[(b * -3.08641975308642e-5), $MachinePrecision] + N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              angle_m = \left|angle\right|
              
              \\
              \begin{array}{l}
              \mathbf{if}\;b \leq 2.1 \cdot 10^{+63}:\\
              \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot \left(\pi \cdot \pi\right)\right) \cdot \mathsf{fma}\left(b, b \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right), angle\_m, b \cdot b\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(0.011111111111111112 \cdot \left(angle\_m \cdot \pi\right)\right), 0.5\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if b < 2.1000000000000002e63

                1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                5. Applied rewrites46.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \mathsf{fma}\left(b \cdot b, -3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites55.3%

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

                  if 2.1000000000000002e63 < b

                  1. Initial program 91.7%

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(b \cdot b\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. +-commutativeN/A

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

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

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

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

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

                      \[\leadsto \left(b \cdot b\right) \cdot \mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{90}\right), \frac{1}{2}\right) \]
                    10. lower-PI.f6491.9

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

                    \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)} \]
                7. Recombined 2 regimes into one program.
                8. Final simplification61.0%

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

                Alternative 8: 66.4% accurate, 4.5× speedup?

                \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right)\\ \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\ \end{array} \end{array} \]
                angle_m = (fabs.f64 angle)
                (FPCore (a b angle_m)
                 :precision binary64
                 (let* ((t_0 (* angle_m (* angle_m (* PI PI)))))
                   (if (<= (/ angle_m 180.0) 4e-148)
                     (* b b)
                     (if (<= (/ angle_m 180.0) 7.5e+161)
                       (fma t_0 (* 3.08641975308642e-5 (* a a)) (* b b))
                       (if (<= (/ angle_m 180.0) 2e+286)
                         (* b b)
                         (fma
                          t_0
                          (fma (* a 3.08641975308642e-5) a (* b (* b -3.08641975308642e-5)))
                          (* b b)))))))
                angle_m = fabs(angle);
                double code(double a, double b, double angle_m) {
                	double t_0 = angle_m * (angle_m * (((double) M_PI) * ((double) M_PI)));
                	double tmp;
                	if ((angle_m / 180.0) <= 4e-148) {
                		tmp = b * b;
                	} else if ((angle_m / 180.0) <= 7.5e+161) {
                		tmp = fma(t_0, (3.08641975308642e-5 * (a * a)), (b * b));
                	} else if ((angle_m / 180.0) <= 2e+286) {
                		tmp = b * b;
                	} else {
                		tmp = fma(t_0, fma((a * 3.08641975308642e-5), a, (b * (b * -3.08641975308642e-5))), (b * b));
                	}
                	return tmp;
                }
                
                angle_m = abs(angle)
                function code(a, b, angle_m)
                	t_0 = Float64(angle_m * Float64(angle_m * Float64(pi * pi)))
                	tmp = 0.0
                	if (Float64(angle_m / 180.0) <= 4e-148)
                		tmp = Float64(b * b);
                	elseif (Float64(angle_m / 180.0) <= 7.5e+161)
                		tmp = fma(t_0, Float64(3.08641975308642e-5 * Float64(a * a)), Float64(b * b));
                	elseif (Float64(angle_m / 180.0) <= 2e+286)
                		tmp = Float64(b * b);
                	else
                		tmp = fma(t_0, fma(Float64(a * 3.08641975308642e-5), a, Float64(b * Float64(b * -3.08641975308642e-5))), Float64(b * b));
                	end
                	return tmp
                end
                
                angle_m = N[Abs[angle], $MachinePrecision]
                code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e-148], N[(b * b), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 7.5e+161], N[(t$95$0 * N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+286], N[(b * b), $MachinePrecision], N[(t$95$0 * N[(N[(a * 3.08641975308642e-5), $MachinePrecision] * a + N[(b * N[(b * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]]]]]
                
                \begin{array}{l}
                angle_m = \left|angle\right|
                
                \\
                \begin{array}{l}
                t_0 := angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right)\\
                \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
                \;\;\;\;b \cdot b\\
                
                \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\
                \;\;\;\;\mathsf{fma}\left(t\_0, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
                
                \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\
                \;\;\;\;b \cdot b\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148 or 7.4999999999999995e161 < (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000007e286

                  1. Initial program 78.6%

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

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

                      \[\leadsto \color{blue}{b \cdot b} \]
                    2. lower-*.f6464.0

                      \[\leadsto \color{blue}{b \cdot b} \]
                  5. Applied rewrites64.0%

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

                  if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 7.4999999999999995e161

                  1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                  5. Applied rewrites43.9%

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

                    \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{32400} \cdot \color{blue}{{a}^{2}}, b \cdot b\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites75.6%

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

                    if 2.00000000000000007e286 < (/.f64 angle #s(literal 180 binary64))

                    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                    5. Applied rewrites57.6%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \mathsf{fma}\left(b \cdot b, -3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)} \]
                    6. Step-by-step derivation
                      1. Applied rewrites57.6%

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \mathsf{fma}\left(a \cdot 3.08641975308642 \cdot 10^{-5}, a, b \cdot \left(b \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), b \cdot b\right)\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 9: 67.0% accurate, 5.1× speedup?

                    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    angle_m = (fabs.f64 angle)
                    (FPCore (a b angle_m)
                     :precision binary64
                     (let* ((t_0
                             (fma
                              (* angle_m (* angle_m (* PI PI)))
                              (* 3.08641975308642e-5 (* a a))
                              (* b b))))
                       (if (<= (/ angle_m 180.0) 4e-148)
                         (* b b)
                         (if (<= (/ angle_m 180.0) 7.5e+161)
                           t_0
                           (if (<= (/ angle_m 180.0) 2e+286) (* b b) t_0)))))
                    angle_m = fabs(angle);
                    double code(double a, double b, double angle_m) {
                    	double t_0 = fma((angle_m * (angle_m * (((double) M_PI) * ((double) M_PI)))), (3.08641975308642e-5 * (a * a)), (b * b));
                    	double tmp;
                    	if ((angle_m / 180.0) <= 4e-148) {
                    		tmp = b * b;
                    	} else if ((angle_m / 180.0) <= 7.5e+161) {
                    		tmp = t_0;
                    	} else if ((angle_m / 180.0) <= 2e+286) {
                    		tmp = b * b;
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    angle_m = abs(angle)
                    function code(a, b, angle_m)
                    	t_0 = fma(Float64(angle_m * Float64(angle_m * Float64(pi * pi))), Float64(3.08641975308642e-5 * Float64(a * a)), Float64(b * b))
                    	tmp = 0.0
                    	if (Float64(angle_m / 180.0) <= 4e-148)
                    		tmp = Float64(b * b);
                    	elseif (Float64(angle_m / 180.0) <= 7.5e+161)
                    		tmp = t_0;
                    	elseif (Float64(angle_m / 180.0) <= 2e+286)
                    		tmp = Float64(b * b);
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    angle_m = N[Abs[angle], $MachinePrecision]
                    code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(angle$95$m * N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e-148], N[(b * b), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 7.5e+161], t$95$0, If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+286], N[(b * b), $MachinePrecision], t$95$0]]]]
                    
                    \begin{array}{l}
                    angle_m = \left|angle\right|
                    
                    \\
                    \begin{array}{l}
                    t_0 := \mathsf{fma}\left(angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\
                    \mathbf{if}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{-148}:\\
                    \;\;\;\;b \cdot b\\
                    
                    \mathbf{elif}\;\frac{angle\_m}{180} \leq 7.5 \cdot 10^{+161}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+286}:\\
                    \;\;\;\;b \cdot b\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 angle #s(literal 180 binary64)) < 3.99999999999999974e-148 or 7.4999999999999995e161 < (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000007e286

                      1. Initial program 78.6%

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

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

                          \[\leadsto \color{blue}{b \cdot b} \]
                        2. lower-*.f6464.0

                          \[\leadsto \color{blue}{b \cdot b} \]
                      5. Applied rewrites64.0%

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

                      if 3.99999999999999974e-148 < (/.f64 angle #s(literal 180 binary64)) < 7.4999999999999995e161 or 2.00000000000000007e286 < (/.f64 angle #s(literal 180 binary64))

                      1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                      5. Applied rewrites45.2%

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

                        \[\leadsto \mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), \frac{1}{32400} \cdot \color{blue}{{a}^{2}}, b \cdot b\right) \]
                      7. Step-by-step derivation
                        1. Applied rewrites73.9%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-148}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;\frac{angle}{180} \leq 7.5 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), b \cdot b\right)\\ \end{array} \]
                      10. Add Preprocessing

                      Alternative 10: 59.9% accurate, 8.3× speedup?

                      \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot \left(\pi \cdot \pi\right)\right) \cdot \mathsf{fma}\left(b, b \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right), angle\_m, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
                      angle_m = (fabs.f64 angle)
                      (FPCore (a b angle_m)
                       :precision binary64
                       (if (<= b 2.1e+63)
                         (fma
                          (*
                           (* angle_m (* PI PI))
                           (fma b (* b -3.08641975308642e-5) (* 3.08641975308642e-5 (* a a))))
                          angle_m
                          (* b b))
                         (* b b)))
                      angle_m = fabs(angle);
                      double code(double a, double b, double angle_m) {
                      	double tmp;
                      	if (b <= 2.1e+63) {
                      		tmp = fma(((angle_m * (((double) M_PI) * ((double) M_PI))) * fma(b, (b * -3.08641975308642e-5), (3.08641975308642e-5 * (a * a)))), angle_m, (b * b));
                      	} else {
                      		tmp = b * b;
                      	}
                      	return tmp;
                      }
                      
                      angle_m = abs(angle)
                      function code(a, b, angle_m)
                      	tmp = 0.0
                      	if (b <= 2.1e+63)
                      		tmp = fma(Float64(Float64(angle_m * Float64(pi * pi)) * fma(b, Float64(b * -3.08641975308642e-5), Float64(3.08641975308642e-5 * Float64(a * a)))), angle_m, Float64(b * b));
                      	else
                      		tmp = Float64(b * b);
                      	end
                      	return tmp
                      end
                      
                      angle_m = N[Abs[angle], $MachinePrecision]
                      code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.1e+63], N[(N[(N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(b * N[(b * -3.08641975308642e-5), $MachinePrecision] + N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]
                      
                      \begin{array}{l}
                      angle_m = \left|angle\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;b \leq 2.1 \cdot 10^{+63}:\\
                      \;\;\;\;\mathsf{fma}\left(\left(angle\_m \cdot \left(\pi \cdot \pi\right)\right) \cdot \mathsf{fma}\left(b, b \cdot -3.08641975308642 \cdot 10^{-5}, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right), angle\_m, b \cdot b\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;b \cdot b\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if b < 2.1000000000000002e63

                        1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                        5. Applied rewrites46.9%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right), \mathsf{fma}\left(b \cdot b, -3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites55.3%

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

                          if 2.1000000000000002e63 < b

                          1. Initial program 91.7%

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6492.0

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites92.0%

                            \[\leadsto \color{blue}{b \cdot b} \]
                        7. Recombined 2 regimes into one program.
                        8. Final simplification61.0%

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

                        Alternative 11: 61.1% accurate, 12.1× speedup?

                        \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;a \leq 9 \cdot 10^{+147}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\ \end{array} \end{array} \]
                        angle_m = (fabs.f64 angle)
                        (FPCore (a b angle_m)
                         :precision binary64
                         (if (<= a 9e+147)
                           (* b b)
                           (* 3.08641975308642e-5 (* (* a a) (* (* angle_m PI) (* angle_m PI))))))
                        angle_m = fabs(angle);
                        double code(double a, double b, double angle_m) {
                        	double tmp;
                        	if (a <= 9e+147) {
                        		tmp = b * b;
                        	} else {
                        		tmp = 3.08641975308642e-5 * ((a * a) * ((angle_m * ((double) M_PI)) * (angle_m * ((double) M_PI))));
                        	}
                        	return tmp;
                        }
                        
                        angle_m = Math.abs(angle);
                        public static double code(double a, double b, double angle_m) {
                        	double tmp;
                        	if (a <= 9e+147) {
                        		tmp = b * b;
                        	} else {
                        		tmp = 3.08641975308642e-5 * ((a * a) * ((angle_m * Math.PI) * (angle_m * Math.PI)));
                        	}
                        	return tmp;
                        }
                        
                        angle_m = math.fabs(angle)
                        def code(a, b, angle_m):
                        	tmp = 0
                        	if a <= 9e+147:
                        		tmp = b * b
                        	else:
                        		tmp = 3.08641975308642e-5 * ((a * a) * ((angle_m * math.pi) * (angle_m * math.pi)))
                        	return tmp
                        
                        angle_m = abs(angle)
                        function code(a, b, angle_m)
                        	tmp = 0.0
                        	if (a <= 9e+147)
                        		tmp = Float64(b * b);
                        	else
                        		tmp = Float64(3.08641975308642e-5 * Float64(Float64(a * a) * Float64(Float64(angle_m * pi) * Float64(angle_m * pi))));
                        	end
                        	return tmp
                        end
                        
                        angle_m = abs(angle);
                        function tmp_2 = code(a, b, angle_m)
                        	tmp = 0.0;
                        	if (a <= 9e+147)
                        		tmp = b * b;
                        	else
                        		tmp = 3.08641975308642e-5 * ((a * a) * ((angle_m * pi) * (angle_m * pi)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        angle_m = N[Abs[angle], $MachinePrecision]
                        code[a_, b_, angle$95$m_] := If[LessEqual[a, 9e+147], N[(b * b), $MachinePrecision], N[(3.08641975308642e-5 * N[(N[(a * a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        angle_m = \left|angle\right|
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;a \leq 9 \cdot 10^{+147}:\\
                        \;\;\;\;b \cdot b\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if a < 9.00000000000000016e147

                          1. Initial program 76.8%

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6463.5

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites63.5%

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

                          if 9.00000000000000016e147 < a

                          1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \left(\frac{1}{32400} \cdot {a}^{2} + \frac{-1}{32400} \cdot {b}^{2}\right)} + {b}^{2} \]
                          5. Applied rewrites50.8%

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

                            \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                          7. Step-by-step derivation
                            1. Applied rewrites70.9%

                              \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \color{blue}{\left(\left(a \cdot a\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(angle \cdot \pi\right)\right)\right)} \]
                          8. Recombined 2 regimes into one program.
                          9. Add Preprocessing

                          Alternative 12: 56.7% accurate, 74.7× speedup?

                          \[\begin{array}{l} angle_m = \left|angle\right| \\ b \cdot b \end{array} \]
                          angle_m = (fabs.f64 angle)
                          (FPCore (a b angle_m) :precision binary64 (* b b))
                          angle_m = fabs(angle);
                          double code(double a, double b, double angle_m) {
                          	return b * b;
                          }
                          
                          angle_m = abs(angle)
                          real(8) function code(a, b, angle_m)
                              real(8), intent (in) :: a
                              real(8), intent (in) :: b
                              real(8), intent (in) :: angle_m
                              code = b * b
                          end function
                          
                          angle_m = Math.abs(angle);
                          public static double code(double a, double b, double angle_m) {
                          	return b * b;
                          }
                          
                          angle_m = math.fabs(angle)
                          def code(a, b, angle_m):
                          	return b * b
                          
                          angle_m = abs(angle)
                          function code(a, b, angle_m)
                          	return Float64(b * b)
                          end
                          
                          angle_m = abs(angle);
                          function tmp = code(a, b, angle_m)
                          	tmp = b * b;
                          end
                          
                          angle_m = N[Abs[angle], $MachinePrecision]
                          code[a_, b_, angle$95$m_] := N[(b * b), $MachinePrecision]
                          
                          \begin{array}{l}
                          angle_m = \left|angle\right|
                          
                          \\
                          b \cdot b
                          \end{array}
                          
                          Derivation
                          1. Initial program 78.5%

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

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

                              \[\leadsto \color{blue}{b \cdot b} \]
                            2. lower-*.f6460.3

                              \[\leadsto \color{blue}{b \cdot b} \]
                          5. Applied rewrites60.3%

                            \[\leadsto \color{blue}{b \cdot b} \]
                          6. Add Preprocessing

                          Reproduce

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