ab-angle->ABCF A

Percentage Accurate: 80.4% → 80.3%
Time: 27.0s
Alternatives: 11
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 80.4% accurate, 1.0× speedup?

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

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

Alternative 1: 80.3% accurate, 0.6× speedup?

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

\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left({\pi}^{0.08333333333333333}\right)}^{8} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.9%

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u62.7%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    2. associate-*l/62.7%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)\right)\right)\right)}^{2} \]
    4. div-inv62.7%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)\right)\right)\right)}^{2} \]
    5. metadata-eval62.7%

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
  5. Step-by-step derivation
    1. expm1-log1p-u81.0%

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\pi \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    7. add-cube-cbrt80.9%

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{{\left(\sqrt[3]{\pi}\right)}^{2}} \cdot \left(\sqrt[3]{\pi} \cdot \frac{angle}{180}\right)\right)\right)}^{2} \]
    10. div-inv81.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt[3]{\pi}\right)}^{2} \cdot \left(\sqrt[3]{\pi} \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)\right)}^{2} \]
    11. metadata-eval81.0%

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left({\left(\sqrt[3]{\pi}\right)}^{2} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}\right)}^{2} \]
  7. Step-by-step derivation
    1. add-sqr-sqrt81.1%

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left({\color{blue}{\left({\pi}^{\left(\frac{0.3333333333333333}{2}\right)}\right)}}^{2}\right)}^{2} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
    5. metadata-eval81.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{{\left({\pi}^{0.16666666666666666}\right)}^{\left(2 \cdot 2\right)}} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
    2. add-sqr-sqrt81.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\color{blue}{\left(\sqrt{{\pi}^{0.16666666666666666}} \cdot \sqrt{{\pi}^{0.16666666666666666}}\right)}}^{\left(2 \cdot 2\right)} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
    3. unpow-prod-down81.1%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left({\color{blue}{\left({\pi}^{\left(\frac{0.16666666666666666}{2}\right)}\right)}}^{\left(2 \cdot 2\right)} \cdot {\left(\sqrt{{\pi}^{0.16666666666666666}}\right)}^{\left(2 \cdot 2\right)}\right) \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
    5. metadata-eval81.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left({\left({\pi}^{\color{blue}{0.08333333333333333}}\right)}^{\left(2 \cdot 2\right)} \cdot {\left(\sqrt{{\pi}^{0.16666666666666666}}\right)}^{\left(2 \cdot 2\right)}\right) \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
    6. metadata-eval81.1%

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left({\left({\pi}^{0.08333333333333333}\right)}^{4} \cdot {\left({\pi}^{0.08333333333333333}\right)}^{\color{blue}{4}}\right) \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
  10. Applied egg-rr81.1%

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left({\left({\pi}^{0.08333333333333333}\right)}^{4} \cdot {\left({\pi}^{0.08333333333333333}\right)}^{4}\right)} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
  11. Step-by-step derivation
    1. pow-sqr81.1%

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

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{{\left({\pi}^{0.08333333333333333}\right)}^{8}} \cdot \left(\sqrt[3]{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} \]
  13. Final simplification81.1%

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

Alternative 2: 80.4% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out80.9%

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-*r/80.6%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    4. associate-*l/80.6%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \color{blue}{\left(\frac{angle \cdot \pi}{180}\right)}\right)\right)\right)}^{2} \]
    5. associate-*r/81.0%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \color{blue}{\left(angle \cdot \frac{\pi}{180}\right)}\right)\right)\right)}^{2} \]
    6. div-inv81.0%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)\right)\right)\right)}^{2} \]
    7. metadata-eval81.0%

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

    \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
  7. Final simplification81.0%

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

Alternative 3: 64.8% accurate, 0.7× speedup?

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

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

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u62.7%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    2. associate-*l/62.7%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)\right)\right)\right)}^{2} \]
    4. div-inv62.7%

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)\right)\right)\right)}^{2} \]
    5. metadata-eval62.7%

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

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

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

Alternative 4: 80.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out80.9%

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

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

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

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

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

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

Alternative 5: 80.3% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out80.9%

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

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

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

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

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

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

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

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

Alternative 6: 80.4% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out80.9%

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

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

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

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

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

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

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

Alternative 7: 67.0% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.7 \cdot 10^{+27}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out78.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*73.2%

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 8.7000000000000004e27 < a

    1. Initial program 88.6%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out88.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*85.6%

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    9. Step-by-step derivation
      1. unpow285.6%

        \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      2. associate-*r*85.7%

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left(angle \cdot a\right)\right)} \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      3. *-commutative85.7%

        \[\leadsto \left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot \left(angle \cdot a\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      4. associate-*l*85.7%

        \[\leadsto \color{blue}{\left(\pi \cdot 0.005555555555555556\right) \cdot \left(\left(angle \cdot a\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      5. associate-*r*85.8%

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

        \[\leadsto \left(\pi \cdot 0.005555555555555556\right) \cdot \left(\left(angle \cdot a\right) \cdot \left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot \left(angle \cdot a\right)\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      7. associate-*l*85.7%

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

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

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

Alternative 8: 67.0% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.2 \cdot 10^{+27}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out78.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*73.2%

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 2.1999999999999999e27 < a

    1. Initial program 88.6%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out88.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*85.6%

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    9. Step-by-step derivation
      1. unpow285.6%

        \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      2. associate-*r*85.7%

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*r*85.7%

        \[\leadsto \left(\color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left(angle \cdot a\right)\right)} \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      4. *-commutative85.7%

        \[\leadsto \left(\left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot \left(angle \cdot a\right)\right) \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      5. associate-*l*85.7%

        \[\leadsto \left(\color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right)\right)} \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right) + {\left(b \cdot 1\right)}^{2} \]
      6. associate-*r*85.7%

        \[\leadsto \left(\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556\right) \cdot \color{blue}{\left(\left(\pi \cdot angle\right) \cdot a\right)} + {\left(b \cdot 1\right)}^{2} \]
      7. *-commutative85.7%

        \[\leadsto \left(\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556\right) \cdot \left(\color{blue}{\left(angle \cdot \pi\right)} \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      8. associate-*l*85.7%

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

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

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

Alternative 9: 67.0% accurate, 3.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.5 \cdot 10^{+27}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out78.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative73.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*73.2%

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 3.5000000000000002e27 < a

    1. Initial program 88.6%

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out88.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative85.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*85.6%

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    9. Step-by-step derivation
      1. unpow285.6%

        \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative85.6%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \color{blue}{\left(\left(\pi \cdot \left(angle \cdot a\right)\right) \cdot 0.005555555555555556\right)} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*r*85.7%

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556} + {\left(b \cdot 1\right)}^{2} \]
      4. associate-*r*85.7%

        \[\leadsto \left(\color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left(angle \cdot a\right)\right)} \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556 + {\left(b \cdot 1\right)}^{2} \]
      5. *-commutative85.7%

        \[\leadsto \left(\left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556 + {\left(b \cdot 1\right)}^{2} \]
      6. associate-*l*85.7%

        \[\leadsto \left(\color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right)\right)} \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot 0.005555555555555556 + {\left(b \cdot 1\right)}^{2} \]
      7. associate-*r*85.7%

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

        \[\leadsto \left(\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(\color{blue}{\left(angle \cdot \pi\right)} \cdot a\right)\right) \cdot 0.005555555555555556 + {\left(b \cdot 1\right)}^{2} \]
      9. associate-*l*85.8%

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

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

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

Alternative 10: 63.4% accurate, 3.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.1 \cdot 10^{+152}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 78.4%

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
      4. distribute-lft-neg-out78.4%

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out78.4%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative72.6%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*72.6%

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 3.1e152 < a

    1. Initial program 99.7%

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
      4. distribute-lft-neg-out99.7%

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out99.7%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    7. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      2. *-commutative99.7%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
      3. associate-*l*99.6%

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

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
    9. Step-by-step derivation
      1. add-cube-cbrt99.0%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}} \cdot \sqrt[3]{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}}\right) \cdot \sqrt[3]{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}}} \]
      2. pow399.1%

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(\mathsf{hypot}\left(\pi \cdot \left(0.005555555555555556 \cdot \left(angle \cdot a\right)\right), b\right)\right)}^{2}}\right)}^{3}} \]
    11. Taylor expanded in angle around inf 64.0%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left({a}^{2} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right)\right)} \]
    12. Step-by-step derivation
      1. associate-*r*64.0%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \color{blue}{\left(\left({a}^{2} \cdot {angle}^{2}\right) \cdot {\pi}^{2}\right)} \]
      2. unpow264.0%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\color{blue}{\left(a \cdot a\right)} \cdot {angle}^{2}\right) \cdot {\pi}^{2}\right) \]
      3. unpow264.0%

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

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\color{blue}{\left(\left(a \cdot angle\right) \cdot \left(a \cdot angle\right)\right)} \cdot {\pi}^{2}\right) \]
      5. *-commutative86.9%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\color{blue}{\left(angle \cdot a\right)} \cdot \left(a \cdot angle\right)\right) \cdot {\pi}^{2}\right) \]
      6. *-commutative86.9%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\left(angle \cdot a\right) \cdot \color{blue}{\left(angle \cdot a\right)}\right) \cdot {\pi}^{2}\right) \]
      7. unpow286.9%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\left(angle \cdot a\right) \cdot \left(angle \cdot a\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)}\right) \]
      8. swap-sqr86.9%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \color{blue}{\left(\left(\left(angle \cdot a\right) \cdot \pi\right) \cdot \left(\left(angle \cdot a\right) \cdot \pi\right)\right)} \]
      9. *-commutative86.9%

        \[\leadsto 3.08641975308642 \cdot 10^{-5} \cdot \left(\color{blue}{\left(\pi \cdot \left(angle \cdot a\right)\right)} \cdot \left(\left(angle \cdot a\right) \cdot \pi\right)\right) \]
      10. *-commutative86.9%

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

        \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot 0.005555555555555556\right)} \cdot \left(\left(\pi \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \]
      12. swap-sqr86.9%

        \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} \]
      13. unpow286.9%

        \[\leadsto \color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2}} \]
      14. associate-*r*87.0%

        \[\leadsto {\color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left(angle \cdot a\right)\right)}}^{2} \]
      15. *-commutative87.0%

        \[\leadsto {\left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot \left(angle \cdot a\right)\right)}^{2} \]
    13. Simplified87.0%

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

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

Alternative 11: 57.6% accurate, 4.1× speedup?

\[\begin{array}{l} \\ {b}^{2} \end{array} \]
(FPCore (a b angle) :precision binary64 (pow b 2.0))
double code(double a, double b, double angle) {
	return pow(b, 2.0);
}
real(8) function code(a, b, angle)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = b ** 2.0d0
end function
public static double code(double a, double b, double angle) {
	return Math.pow(b, 2.0);
}
def code(a, b, angle):
	return math.pow(b, 2.0)
function code(a, b, angle)
	return b ^ 2.0
end
function tmp = code(a, b, angle)
	tmp = b ^ 2.0;
end
code[a_, b_, angle_] := N[Power[b, 2.0], $MachinePrecision]
\begin{array}{l}

\\
{b}^{2}
\end{array}
Derivation
  1. Initial program 80.9%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out80.9%

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

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

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

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

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

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

    \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} + {\left(b \cdot 1\right)}^{2} \]
  7. Step-by-step derivation
    1. *-commutative75.8%

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

      \[\leadsto {\left(0.005555555555555556 \cdot \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
    3. associate-*l*75.8%

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

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

    \[\leadsto \color{blue}{{b}^{2}} \]
  10. Final simplification58.2%

    \[\leadsto {b}^{2} \]
  11. Add Preprocessing

Reproduce

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