ab-angle->ABCF A

Percentage Accurate: 79.9% → 79.7%
Time: 17.1s
Alternatives: 14
Speedup: 1.2×

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 14 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.9% 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.7% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.7% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.8% accurate, 1.2× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\\ \mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \frac{0.005555555555555556}{\frac{1}{angle\_m \cdot \pi}}\right)\right)\right) \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (let* ((t_0 (* a (sin (* PI (* angle_m 0.005555555555555556))))))
   (fma
    t_0
    t_0
    (*
     (* b b)
     (+
      0.5
      (*
       0.5
       (cos (* 2.0 (/ 0.005555555555555556 (/ 1.0 (* angle_m PI)))))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = a * sin((((double) M_PI) * (angle_m * 0.005555555555555556)));
	return fma(t_0, t_0, ((b * b) * (0.5 + (0.5 * cos((2.0 * (0.005555555555555556 / (1.0 / (angle_m * ((double) M_PI))))))))));
}
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(a * sin(Float64(pi * Float64(angle_m * 0.005555555555555556))))
	return fma(t_0, t_0, Float64(Float64(b * b) * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * Float64(0.005555555555555556 / Float64(1.0 / Float64(angle_m * pi)))))))))
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(a * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(0.005555555555555556 / N[(1.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \color{blue}{0.005555555555555556}\right) \cdot \pi\right), a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\right) \]
    9. lift-/.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right), a \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    12. metadata-eval80.9

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right), a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right), \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right), a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right), \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \color{blue}{\frac{0.005555555555555556}{\frac{1}{angle \cdot \pi}}}\right)\right)\right) \]
  7. Final simplification80.9%

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

Alternative 5: 79.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \color{blue}{0.005555555555555556}\right) \cdot \pi\right), a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\right) \]
    9. lift-/.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right), a \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    12. metadata-eval80.9

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

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

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

Alternative 6: 79.7% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 79.8% accurate, 1.8× speedup?

    \[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\\ \mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot 1\right) \end{array} \end{array} \]
    angle_m = (fabs.f64 angle)
    (FPCore (a b angle_m)
     :precision binary64
     (let* ((t_0 (* a (sin (* PI (* angle_m 0.005555555555555556))))))
       (fma t_0 t_0 (* (* b b) 1.0))))
    angle_m = fabs(angle);
    double code(double a, double b, double angle_m) {
    	double t_0 = a * sin((((double) M_PI) * (angle_m * 0.005555555555555556)));
    	return fma(t_0, t_0, ((b * b) * 1.0));
    }
    
    angle_m = abs(angle)
    function code(a, b, angle_m)
    	t_0 = Float64(a * sin(Float64(pi * Float64(angle_m * 0.005555555555555556))))
    	return fma(t_0, t_0, Float64(Float64(b * b) * 1.0))
    end
    
    angle_m = N[Abs[angle], $MachinePrecision]
    code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(a * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    angle_m = \left|angle\right|
    
    \\
    \begin{array}{l}
    t_0 := a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\\
    \mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot 1\right)
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 80.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \color{blue}{0.005555555555555556}\right) \cdot \pi\right), a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\right) \]
      9. lift-/.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right), a \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
      12. metadata-eval80.9

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right), a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right), \left(b \cdot b\right) \cdot 1\right) \]
      3. Add Preprocessing

      Alternative 8: 56.0% accurate, 3.4× speedup?

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

        1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 2.5000000000000001e147 < b

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \color{blue}{0.005555555555555556}\right) \cdot \pi\right), a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\right) \]
            9. lift-/.f64N/A

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

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

              \[\leadsto \mathsf{fma}\left(a \cdot \sin \left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right), a \cdot \sin \left(\color{blue}{\left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right), {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
            12. metadata-eval100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 9: 56.0% accurate, 8.3× speedup?

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

          1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 2.5000000000000001e147 < b

            1. Initial program 100.0%

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

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

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

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

              \[\leadsto \color{blue}{b \cdot b} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 10: 64.0% accurate, 9.1× speedup?

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

            1. Initial program 80.0%

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

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

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

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

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

            if 2.69999999999999991e-43 < a < 8.8000000000000007e147

            1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 8.8000000000000007e147 < a

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 11: 62.4% accurate, 12.1× speedup?

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

                  1. Initial program 78.9%

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

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

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

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

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

                  if 1.25e128 < a

                  1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 12: 63.5% accurate, 12.1× speedup?

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

                      1. Initial program 78.9%

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

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

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

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

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

                      if 1.25e128 < a

                      1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 13: 62.3% accurate, 12.1× speedup?

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

                          1. Initial program 78.9%

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

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

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

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

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

                          if 1.3e128 < a

                          1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 14: 58.0% accurate, 74.7× speedup?

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

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

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

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

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

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

                          Reproduce

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