ab-angle->ABCF C

Percentage Accurate: 79.7% → 79.7%
Time: 14.8s
Alternatives: 15
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 79.7% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.7% accurate, 1.9× speedup?

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

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

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

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

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

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

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

Alternative 3: 79.7% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 76.9% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\ \;\;\;\;a \cdot a + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right), a \cdot a\right)}}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= (/ angle 180.0) 2e-14)
   (+ (* a a) (pow (* b (* angle (* PI 0.005555555555555556))) 2.0))
   (/
    1.0
    (/
     1.0
     (fma
      (* b b)
      (fma (cos (* (* PI angle) 0.011111111111111112)) -0.5 0.5)
      (* a a))))))
double code(double a, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-14) {
		tmp = (a * a) + pow((b * (angle * (((double) M_PI) * 0.005555555555555556))), 2.0);
	} else {
		tmp = 1.0 / (1.0 / fma((b * b), fma(cos(((((double) M_PI) * angle) * 0.011111111111111112)), -0.5, 0.5), (a * a)));
	}
	return tmp;
}
function code(a, b, angle)
	tmp = 0.0
	if (Float64(angle / 180.0) <= 2e-14)
		tmp = Float64(Float64(a * a) + (Float64(b * Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0));
	else
		tmp = Float64(1.0 / Float64(1.0 / fma(Float64(b * b), fma(cos(Float64(Float64(pi * angle) * 0.011111111111111112)), -0.5, 0.5), Float64(a * a))));
	end
	return tmp
end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-14], N[(N[(a * a), $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[(N[(b * b), $MachinePrecision] * N[(N[Cos[N[(N[(Pi * angle), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot a + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\

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


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

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-14 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{{\left(a \cdot a\right)}^{3} + {\left({\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2}\right)}^{3}}{\left(a \cdot a\right) \cdot \left(a \cdot a\right) + \left({\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \cdot {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} - \left(a \cdot a\right) \cdot {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2}\right)}}}} \]
    7. Applied egg-rr58.3%

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

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

Alternative 5: 76.9% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\ \;\;\;\;a \cdot a + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot a + \frac{b \cdot b}{\frac{1}{\mathsf{fma}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right), -0.5, 0.5\right)}}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= (/ angle 180.0) 2e-14)
   (+ (* a a) (pow (* b (* angle (* PI 0.005555555555555556))) 2.0))
   (+
    (* a a)
    (/
     (* b b)
     (/ 1.0 (fma (cos (* (* PI angle) 0.011111111111111112)) -0.5 0.5))))))
double code(double a, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-14) {
		tmp = (a * a) + pow((b * (angle * (((double) M_PI) * 0.005555555555555556))), 2.0);
	} else {
		tmp = (a * a) + ((b * b) / (1.0 / fma(cos(((((double) M_PI) * angle) * 0.011111111111111112)), -0.5, 0.5)));
	}
	return tmp;
}
function code(a, b, angle)
	tmp = 0.0
	if (Float64(angle / 180.0) <= 2e-14)
		tmp = Float64(Float64(a * a) + (Float64(b * Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0));
	else
		tmp = Float64(Float64(a * a) + Float64(Float64(b * b) / Float64(1.0 / fma(cos(Float64(Float64(pi * angle) * 0.011111111111111112)), -0.5, 0.5))));
	end
	return tmp
end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-14], N[(N[(a * a), $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] / N[(1.0 / N[(N[Cos[N[(N[(Pi * angle), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot a + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\

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


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

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-14 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot a + \left(b \cdot b\right) \cdot \color{blue}{\frac{1}{\frac{\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right) + \frac{1}{2} \cdot \left(\frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)\right)}{{\frac{1}{2}}^{3} - {\left(\frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right)}^{3}}}} \]
    7. Applied egg-rr58.3%

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

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

Alternative 6: 76.9% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot a + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\

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


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

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-14 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 57.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right) \cdot \left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)} + a \cdot a \]
      3. swap-sqrN/A

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)\right), b, a \cdot a\right)} \]
    7. Applied egg-rr58.3%

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

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

Alternative 7: 67.2% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-77}:\\
\;\;\;\;a \cdot a\\

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


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

    1. Initial program 76.6%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6461.8

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

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

    if 6.00000000000000033e-77 < b

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot a + {\left(\left(angle \cdot \color{blue}{\left(\frac{1}{180} \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot b\right)}^{2} \]
      9. PI-lowering-PI.f6481.4

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

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

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

Alternative 8: 66.1% accurate, 9.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 5.9 \cdot 10^{-77}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{+259}:\\ \;\;\;\;\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= b 5.9e-77)
   (* a a)
   (if (<= b 1.75e+259)
     (fma
      3.08641975308642e-5
      (* (* PI PI) (* angle (* b (* b angle))))
      (* a a))
     (* b (* (* angle 3.08641975308642e-5) (* angle (* b (* PI PI))))))))
double code(double a, double b, double angle) {
	double tmp;
	if (b <= 5.9e-77) {
		tmp = a * a;
	} else if (b <= 1.75e+259) {
		tmp = fma(3.08641975308642e-5, ((((double) M_PI) * ((double) M_PI)) * (angle * (b * (b * angle)))), (a * a));
	} else {
		tmp = b * ((angle * 3.08641975308642e-5) * (angle * (b * (((double) M_PI) * ((double) M_PI)))));
	}
	return tmp;
}
function code(a, b, angle)
	tmp = 0.0
	if (b <= 5.9e-77)
		tmp = Float64(a * a);
	elseif (b <= 1.75e+259)
		tmp = fma(3.08641975308642e-5, Float64(Float64(pi * pi) * Float64(angle * Float64(b * Float64(b * angle)))), Float64(a * a));
	else
		tmp = Float64(b * Float64(Float64(angle * 3.08641975308642e-5) * Float64(angle * Float64(b * Float64(pi * pi)))));
	end
	return tmp
end
code[a_, b_, angle_] := If[LessEqual[b, 5.9e-77], N[(a * a), $MachinePrecision], If[LessEqual[b, 1.75e+259], N[(3.08641975308642e-5 * N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(b * N[(b * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(angle * 3.08641975308642e-5), $MachinePrecision] * N[(angle * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.9 \cdot 10^{-77}:\\
\;\;\;\;a \cdot a\\

\mathbf{elif}\;b \leq 1.75 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right), a \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 5.89999999999999965e-77

    1. Initial program 76.6%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6461.8

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

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

    if 5.89999999999999965e-77 < b < 1.7499999999999999e259

    1. Initial program 81.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6471.7

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \color{blue}{\left(\left(angle \cdot b\right) \cdot b\right)}\right), a \cdot a\right) \]
      3. *-lowering-*.f6477.1

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

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

    if 1.7499999999999999e259 < b

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6465.2

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6465.2

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot b\right) \cdot b\right)\right)\right) \]
    11. Simplified65.2%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      8. *-lowering-*.f64N/A

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

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

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot b \]
      11. *-lowering-*.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \cdot b \]
      12. PI-lowering-PI.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot b \]
      13. PI-lowering-PI.f6488.1

        \[\leadsto \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(b \cdot \left(\pi \cdot \color{blue}{\pi}\right)\right)\right)\right) \cdot b \]
    13. Applied egg-rr88.1%

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

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

Alternative 9: 66.6% accurate, 10.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{-76}:\\
\;\;\;\;a \cdot a\\

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


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

    1. Initial program 76.6%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6461.8

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

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

    if 7.99999999999999942e-76 < b

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6470.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot angle\right)\right) \cdot \left(angle \cdot b\right)\right) \cdot b, a \cdot a\right) \]
      13. *-lowering-*.f6480.4

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

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

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

Alternative 10: 70.7% accurate, 10.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.32 \cdot 10^{+171}:\\
\;\;\;\;\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.32000000000000009e171

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6471.0

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

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

    if 1.32000000000000009e171 < b

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6475.8

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6475.8

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot b\right) \cdot b\right)\right)\right) \]
    11. Simplified75.8%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      8. *-lowering-*.f64N/A

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

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

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot b \]
      11. *-lowering-*.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \cdot b \]
      12. PI-lowering-PI.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot b \]
      13. PI-lowering-PI.f6484.8

        \[\leadsto \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(b \cdot \left(\pi \cdot \color{blue}{\pi}\right)\right)\right)\right) \cdot b \]
    13. Applied egg-rr84.8%

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

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

Alternative 11: 62.0% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.9 \cdot 10^{+167}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.89999999999999975e167

    1. Initial program 76.2%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6462.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Simplified62.1%

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

    if 2.89999999999999975e167 < b

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6477.3

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6477.3

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot b\right) \cdot b\right)\right)\right) \]
    11. Simplified77.3%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{32400} \cdot angle\right) \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b} \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      7. *-lowering-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(angle \cdot \frac{1}{32400}\right)} \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b \]
      8. *-lowering-*.f64N/A

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

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

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot b \]
      11. *-lowering-*.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \cdot b \]
      12. PI-lowering-PI.f64N/A

        \[\leadsto \left(\left(angle \cdot \frac{1}{32400}\right) \cdot \left(angle \cdot \left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot b \]
      13. PI-lowering-PI.f6482.8

        \[\leadsto \left(\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(b \cdot \left(\pi \cdot \color{blue}{\pi}\right)\right)\right)\right) \cdot b \]
    13. Applied egg-rr82.8%

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

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

Alternative 12: 62.0% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.9 \cdot 10^{+167}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.89999999999999975e167

    1. Initial program 76.2%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6462.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Simplified62.1%

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

    if 2.89999999999999975e167 < b

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6477.3

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6477.3

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot b\right) \cdot b\right)\right)\right) \]
    11. Simplified77.3%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left(\left(angle \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right) \cdot b\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(\color{blue}{\left(angle \cdot \left(angle \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)\right)\right)} \cdot b\right) \]
      5. *-lowering-*.f64N/A

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

        \[\leadsto \frac{1}{32400} \cdot \left(\left(angle \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot b\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(\left(angle \cdot \left(angle \cdot \color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right) \cdot b\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(\left(angle \cdot \left(angle \cdot \left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \cdot b\right) \]
      9. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \cdot b\right) \]
      10. PI-lowering-PI.f6480.2

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(angle \cdot \left(angle \cdot \left(b \cdot \left(\pi \cdot \color{blue}{\pi}\right)\right)\right)\right) \cdot b\right) \]
    13. Applied egg-rr80.2%

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

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

Alternative 13: 61.6% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.9 \cdot 10^{+167}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.89999999999999975e167

    1. Initial program 76.2%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6462.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Simplified62.1%

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

    if 2.89999999999999975e167 < b

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6477.3

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6477.3

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot b\right) \cdot b\right)\right)\right) \]
    11. Simplified77.3%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(\color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot angle\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(\color{blue}{\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot angle\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(\left(b \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(b \cdot angle\right)\right)\right) \]
      7. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(\left(b \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot angle\right)\right)\right) \]
      8. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(\left(b \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(b \cdot angle\right)\right)\right) \]
      9. *-lowering-*.f6480.2

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(\left(b \cdot \left(\pi \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot angle\right)}\right)\right) \]
    13. Applied egg-rr80.2%

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

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

Alternative 14: 61.3% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{+119}:\\
\;\;\;\;a \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.75e119

    1. Initial program 76.3%

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      2. *-lowering-*.f6462.6

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Simplified62.6%

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

    if 1.75e119 < b

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{32400}, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right), \color{blue}{a \cdot a}\right) \]
      16. *-lowering-*.f6471.4

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right)\right)\right) \]
      13. PI-lowering-PI.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)\right)\right) \]
      14. PI-lowering-PI.f6469.4

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

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot b\right) \cdot b\right)\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*l*N/A

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

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

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot b\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot b\right)\right)\right)\right) \]
      6. PI-lowering-PI.f64N/A

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

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(b \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{32400} \cdot \left(angle \cdot \left(angle \cdot \left(\left(b \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot \mathsf{PI}\left(\right)\right)}\right)\right)\right) \]
      9. PI-lowering-PI.f6469.4

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(b \cdot \pi\right) \cdot \left(b \cdot \color{blue}{\pi}\right)\right)\right)\right) \]
    13. Applied egg-rr69.4%

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

Alternative 15: 57.2% accurate, 74.7× speedup?

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

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

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

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

      \[\leadsto \color{blue}{a \cdot a} \]
    2. *-lowering-*.f6460.5

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

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

Reproduce

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