ab-angle->ABCF A

Percentage Accurate: 79.3% → 79.2%
Time: 36.9s
Alternatives: 13
Speedup: 1.0×

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 13 alternatives:

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

Initial Program: 79.3% accurate, 1.0× speedup?

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

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

Alternative 1: 79.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle \cdot \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(Float64(angle * 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[(N[(angle * Pi), $MachinePrecision] / 180.0), $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 \cdot \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.2%

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

      \[\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} \]
  3. Applied egg-rr80.6%

    \[\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} \]
  4. Step-by-step derivation
    1. associate-*l/80.6%

      \[\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} \]
  5. Applied egg-rr80.6%

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

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

Alternative 2: 79.3% 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.2%

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

      \[\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-*r/80.6%

      \[\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. 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} \]
    4. 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(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} \]
  3. Simplified80.6%

    \[\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. Final simplification80.6%

    \[\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} \]

Alternative 3: 79.2% accurate, 1.0× speedup?

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

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

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

      \[\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} \]
  3. Applied egg-rr80.6%

    \[\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} \]
  4. Final simplification80.6%

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

Alternative 4: 79.2% accurate, 1.5× speedup?

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

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

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

      \[\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-*r/80.6%

      \[\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. 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} \]
    4. 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(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} \]
  3. Simplified80.6%

    \[\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. Taylor expanded in angle around 0 79.9%

    \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
  5. Taylor expanded in angle around inf 79.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} \]
  6. Final simplification79.5%

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

Alternative 5: 79.3% accurate, 1.5× 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.2%

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

      \[\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-*r/80.6%

      \[\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. 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} \]
    4. 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(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} \]
  3. Simplified80.6%

    \[\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. Taylor expanded in angle around 0 79.9%

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

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

Alternative 6: 76.7% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(a \cdot a\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 8.00000000000000065e-5

    1. Initial program 86.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/86.6%

        \[\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-*r/86.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. associate-*l/86.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} \]
      4. associate-*r/86.6%

        \[\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. Simplified86.6%

      \[\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. Taylor expanded in angle around 0 86.4%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 83.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} \]
    6. Step-by-step derivation
      1. *-commutative83.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. associate-*l*83.2%

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

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

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

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \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. *-commutative83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000065e-5 < angle

    1. Initial program 61.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/63.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-*r/63.1%

        \[\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. associate-*l/63.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} \]
      4. associate-*r/63.1%

        \[\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. Simplified63.1%

      \[\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. Taylor expanded in angle around 0 61.4%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Step-by-step derivation
      1. unpow-prod-down61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 - 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556 + \color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      14. distribute-lft-out61.4%

        \[\leadsto \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(\left(angle \cdot \pi\right) \cdot \left(0.005555555555555556 + 0.005555555555555556\right)\right)}\right) \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      15. metadata-eval61.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;angle \leq 8 \cdot 10^{-5}:\\ \;\;\;\;{b}^{2} + \left(a \cdot angle\right) \cdot \left(\pi \cdot \left(\left(\pi \cdot \left(a \cdot angle\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + \left(a \cdot a\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)\\ \end{array} \]

Alternative 7: 76.7% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{b}^{2} + \frac{-1 + \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)}{-2} \cdot \left(a \cdot a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 8.00000000000000065e-5

    1. Initial program 86.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/86.6%

        \[\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-*r/86.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. associate-*l/86.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} \]
      4. associate-*r/86.6%

        \[\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. Simplified86.6%

      \[\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. Taylor expanded in angle around 0 86.4%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 83.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} \]
    6. Step-by-step derivation
      1. *-commutative83.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. associate-*l*83.2%

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

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

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

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \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. *-commutative83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000065e-5 < angle

    1. Initial program 61.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/63.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-*r/63.1%

        \[\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. associate-*l/63.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} \]
      4. associate-*r/63.1%

        \[\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. Simplified63.1%

      \[\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. Taylor expanded in angle around 0 61.4%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Step-by-step derivation
      1. unpow-prod-down61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\left(\cos 0 - \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)}{-2}} \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
    9. Step-by-step derivation
      1. neg-sub061.4%

        \[\leadsto \frac{\color{blue}{0 - \left(\cos 0 - \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)}}{-2} \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      2. cos-061.4%

        \[\leadsto \frac{0 - \left(\color{blue}{1} - \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)}{-2} \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      3. associate--r-61.4%

        \[\leadsto \frac{\color{blue}{\left(0 - 1\right) + \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)}}{-2} \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
      4. metadata-eval61.4%

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

        \[\leadsto \frac{-1 + \cos \color{blue}{\left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)}}{-2} \cdot \left(a \cdot a\right) + {\left(b \cdot 1\right)}^{2} \]
    10. Simplified61.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;angle \leq 8 \cdot 10^{-5}:\\ \;\;\;\;{b}^{2} + \left(a \cdot angle\right) \cdot \left(\pi \cdot \left(\left(\pi \cdot \left(a \cdot angle\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + \frac{-1 + \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)}{-2} \cdot \left(a \cdot a\right)\\ \end{array} \]

Alternative 8: 67.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 80.2%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. associate-*l/80.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-*r/80.8%

        \[\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. 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 \cdot \pi}{180}\right)}\right)}^{2} \]
      4. associate-*r/80.8%

        \[\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. Simplified80.8%

      \[\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. Taylor expanded in angle around 0 80.2%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. 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} \]
    6. 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. associate-*l*73.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 61.0%

      \[\leadsto \color{blue}{{b}^{2}} \]
    11. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \color{blue}{b \cdot b} \]
    12. Simplified61.0%

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

    if 1.25000000000000005e-154 < a

    1. Initial program 80.2%

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

        \[\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-*r/80.2%

        \[\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. associate-*l/80.2%

        \[\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} \]
      4. associate-*r/80.2%

        \[\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. Simplified80.2%

      \[\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. Taylor expanded in angle around 0 79.5%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 76.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} \]
    6. Step-by-step derivation
      1. *-commutative76.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. associate-*l*76.7%

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

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

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

        \[\leadsto \color{blue}{\left(\left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \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. *-commutative76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.25 \cdot 10^{-154}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + \left(a \cdot angle\right) \cdot \left(\pi \cdot \left(\left(\pi \cdot \left(a \cdot angle\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\\ \end{array} \]

Alternative 9: 67.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(a \cdot angle\right)\\
\mathbf{if}\;a \leq 1.25 \cdot 10^{-154}:\\
\;\;\;\;b \cdot b\\

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


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

    1. Initial program 80.2%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. associate-*l/80.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-*r/80.8%

        \[\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. 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 \cdot \pi}{180}\right)}\right)}^{2} \]
      4. associate-*r/80.8%

        \[\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. Simplified80.8%

      \[\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. Taylor expanded in angle around 0 80.2%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. 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} \]
    6. 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. associate-*l*73.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 61.0%

      \[\leadsto \color{blue}{{b}^{2}} \]
    11. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \color{blue}{b \cdot b} \]
    12. Simplified61.0%

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

    if 1.25000000000000005e-154 < a

    1. Initial program 80.2%

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

        \[\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-*r/80.2%

        \[\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. associate-*l/80.2%

        \[\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} \]
      4. associate-*r/80.2%

        \[\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. Simplified80.2%

      \[\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. Taylor expanded in angle around 0 79.5%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 76.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} \]
    6. Step-by-step derivation
      1. *-commutative76.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. associate-*l*76.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\pi \cdot \left(angle \cdot a\right)\right) \cdot \left(\left(\pi \cdot \left(angle \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)} + {\left(b \cdot 1\right)}^{2} \]
      3. fma-def76.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\pi \cdot \left(angle \cdot a\right), \left(\pi \cdot \left(angle \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}, {\left(b \cdot 1\right)}^{2}\right)} \]
      4. associate-*r*76.8%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(angle \cdot \pi\right)} \cdot a, \left(\pi \cdot \left(angle \cdot a\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}, {\left(b \cdot 1\right)}^{2}\right) \]
      6. associate-*l*76.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.2% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 80.2%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. associate-*l/80.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-*r/80.8%

        \[\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. 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 \cdot \pi}{180}\right)}\right)}^{2} \]
      4. associate-*r/80.8%

        \[\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. Simplified80.8%

      \[\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. Taylor expanded in angle around 0 80.2%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. 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} \]
    6. 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. associate-*l*73.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 61.0%

      \[\leadsto \color{blue}{{b}^{2}} \]
    11. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \color{blue}{b \cdot b} \]
    12. Simplified61.0%

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

    if 1.25000000000000005e-154 < a

    1. Initial program 80.2%

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

        \[\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-*r/80.2%

        \[\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. associate-*l/80.2%

        \[\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} \]
      4. associate-*r/80.2%

        \[\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. Simplified80.2%

      \[\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. Taylor expanded in angle around 0 79.5%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 76.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} \]
    6. Step-by-step derivation
      1. *-commutative76.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. associate-*l*76.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right) \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)} + {\left(b \cdot 1\right)}^{2} \]
      4. fma-def76.8%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(3.08641975308642 \cdot 10^{-5} \cdot \pi\right) \cdot \left(angle \cdot a\right)}, \pi \cdot \left(angle \cdot a\right), {\left(b \cdot 1\right)}^{2}\right) \]
      6. associate-*r*76.8%

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

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

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

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

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

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

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

Alternative 11: 67.2% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 80.2%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. associate-*l/80.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-*r/80.8%

        \[\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. 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 \cdot \pi}{180}\right)}\right)}^{2} \]
      4. associate-*r/80.8%

        \[\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. Simplified80.8%

      \[\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. Taylor expanded in angle around 0 80.2%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. 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} \]
    6. 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. associate-*l*73.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 61.0%

      \[\leadsto \color{blue}{{b}^{2}} \]
    11. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \color{blue}{b \cdot b} \]
    12. Simplified61.0%

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

    if 1.25000000000000005e-154 < a

    1. Initial program 80.2%

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

        \[\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-*r/80.2%

        \[\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. associate-*l/80.2%

        \[\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} \]
      4. associate-*r/80.2%

        \[\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. Simplified80.2%

      \[\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. Taylor expanded in angle around 0 79.5%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 76.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} \]
    6. Step-by-step derivation
      1. *-commutative76.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. associate-*l*76.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 57.0%

      \[\leadsto \color{blue}{3.08641975308642 \cdot 10^{-5} \cdot \left({a}^{2} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right)\right) + {b}^{2}} \]
    11. Step-by-step derivation
      1. fma-def57.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \color{blue}{\left(\left(angle \cdot \pi\right) \cdot a\right) \cdot \left(\left(angle \cdot \pi\right) \cdot a\right)}, b \cdot b\right) \]
      9. associate-*r*76.8%

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

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

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

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

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

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

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

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

Alternative 12: 67.1% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 80.2%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. associate-*l/80.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-*r/80.8%

        \[\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. 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 \cdot \pi}{180}\right)}\right)}^{2} \]
      4. associate-*r/80.8%

        \[\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. Simplified80.8%

      \[\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. Taylor expanded in angle around 0 80.2%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. 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} \]
    6. 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. associate-*l*73.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
    10. Taylor expanded in angle around 0 61.0%

      \[\leadsto \color{blue}{{b}^{2}} \]
    11. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \color{blue}{b \cdot b} \]
    12. Simplified61.0%

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

    if 1.25000000000000005e-154 < a

    1. Initial program 80.2%

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

        \[\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-*r/80.2%

        \[\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. associate-*l/80.2%

        \[\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} \]
      4. associate-*r/80.2%

        \[\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. Simplified80.2%

      \[\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. Taylor expanded in angle around 0 79.5%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
    5. Taylor expanded in angle around 0 76.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} \]
    6. Step-by-step derivation
      1. *-commutative76.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. associate-*l*76.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{b \cdot b} + {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5} \]
      4. fma-def76.7%

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

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

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

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

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

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

Alternative 13: 57.3% accurate, 205.0× speedup?

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

\\
b \cdot b
\end{array}
Derivation
  1. Initial program 80.2%

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

      \[\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-*r/80.6%

      \[\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. 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} \]
    4. 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(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} \]
  3. Simplified80.6%

    \[\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. Taylor expanded in angle around 0 79.9%

    \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
  5. Taylor expanded in angle around 0 74.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} \]
  6. Step-by-step derivation
    1. *-commutative74.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. associate-*l*74.6%

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

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

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

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

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

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

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

      \[\leadsto {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot \color{blue}{3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
  9. Applied egg-rr74.6%

    \[\leadsto \color{blue}{{\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}} + {\left(b \cdot 1\right)}^{2} \]
  10. Taylor expanded in angle around 0 56.1%

    \[\leadsto \color{blue}{{b}^{2}} \]
  11. Step-by-step derivation
    1. unpow256.1%

      \[\leadsto \color{blue}{b \cdot b} \]
  12. Simplified56.1%

    \[\leadsto \color{blue}{b \cdot b} \]
  13. Final simplification56.1%

    \[\leadsto b \cdot b \]

Reproduce

?
herbie shell --seed 2023297 
(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)))