ab-angle->ABCF C

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 78.9% accurate, 1.0× speedup?

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

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

Alternative 1: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 38.4% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(b \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right) \cdot \left(\sqrt{b} \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right), \sqrt{b}, a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)\right)\right)} \]
  10. Final simplification38.0%

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

Alternative 4: 78.9% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.9% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

Alternative 6: 72.2% accurate, 2.6× speedup?

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

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

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


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

    1. Initial program 82.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. Step-by-step derivation
      1. lift-PI.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000001e-8 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 60.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. Step-by-step derivation
      1. lift-PI.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 55.4% accurate, 3.1× speedup?

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

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

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


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

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(b \cdot b, \frac{1}{32400}, \left(a \cdot a\right) \cdot \frac{-1}{32400}\right)\right)\right) + \color{blue}{a \cdot a} \]
    7. Applied rewrites49.3%

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

    if 1.54999999999999985e-39 < a

    1. Initial program 78.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. Step-by-step derivation
      1. lift-PI.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 52.5% accurate, 7.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.45 \cdot 10^{-152}:\\
\;\;\;\;angle \cdot \left(\left(\pi \cdot angle\right) \cdot \left(\pi \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;a \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.4500000000000001e-152

    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}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
    4. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot \frac{1}{32400}\right)\right)\right) \]
      18. lower-*.f6441.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4500000000000001e-152 < a < 3.4999999999999998e144

    1. Initial program 63.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}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
    4. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

    if 3.4999999999999998e144 < a

    1. Initial program 97.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}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

      \[\leadsto \color{blue}{a \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.8%

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

Alternative 9: 55.4% accurate, 8.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;a \cdot a\\


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

    1. Initial program 72.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}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
    4. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(b \cdot b, \frac{1}{32400}, \left(a \cdot a\right) \cdot \frac{-1}{32400}\right)\right)\right) + \color{blue}{a \cdot a} \]
    7. Applied rewrites48.4%

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

    if 3.4999999999999998e144 < a

    1. Initial program 97.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}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

      \[\leadsto \color{blue}{a \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 60.0% accurate, 12.1× speedup?

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

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

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


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

    1. Initial program 75.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}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

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

    if 9.7999999999999998e67 < b

    1. Initial program 79.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}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
    4. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 58.8% accurate, 12.1× speedup?

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

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

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


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

    1. Initial program 75.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}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

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

    if 9.7999999999999998e67 < b

    1. Initial program 79.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}{{angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}} \]
    4. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 55.9% accurate, 74.7× speedup?

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

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

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

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

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

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

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

Reproduce

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