ab-angle->ABCF A

Percentage Accurate: 79.3% → 79.3%
Time: 7.3s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

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

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

Initial Program: 79.3% accurate, 1.0× speedup?

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

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

Alternative 1: 79.3% accurate, 0.7× speedup?

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

\\
\mathsf{fma}\left(\frac{\cos \left(\mathsf{fma}\left(\left|angle\_m \cdot 0.005555555555555556\right|, \pi, angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) + \sin \left(\left|0.005555555555555556 \cdot \left(\pi \cdot angle\_m - \left|angle\_m\right| \cdot \pi\right)\right| + \pi \cdot 0.5\right)}{2}, b \cdot b, {\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\_m\right) \cdot a\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 79.3%

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
  7. Applied rewrites79.3%

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

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

    \[\leadsto \mathsf{fma}\left(\frac{\cos \left(\mathsf{fma}\left(\left|angle \cdot 0.005555555555555556\right|, \pi, angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) + \color{blue}{\sin \left(\left|0.005555555555555556 \cdot \left(\pi \cdot angle - \left|angle\right| \cdot \pi\right)\right| + \pi \cdot 0.5\right)}}{2}, b \cdot b, {\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right) \]
  10. Add Preprocessing

Alternative 2: 79.3% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
  7. Applied rewrites79.3%

    \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)} \cdot a\right)}^{2}\right) \]
  8. Add Preprocessing

Alternative 3: 79.3% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \mathsf{fma}\left(angle\_m \cdot \pi, -0.005555555555555556, \pi \cdot 0.5\right)\right), b \cdot b, {\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\_m\right) \cdot a\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 79.3%

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
  7. Applied rewrites79.3%

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

    \[\leadsto \mathsf{fma}\left(\color{blue}{0.5 - 0.5 \cdot \cos \left(2 \cdot \mathsf{fma}\left(angle \cdot \pi, -0.005555555555555556, \pi \cdot 0.5\right)\right)}, b \cdot b, {\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right) \]
  9. Add Preprocessing

Alternative 4: 79.2% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(b \cdot \mathsf{fma}\left(-0.5, \cos \left(\mathsf{fma}\left(0.011111111111111112, \pi \cdot angle\_m, 1 \cdot \pi\right)\right), 0.5\right), b, {\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\_m\right)\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 79.3%

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
  7. Applied rewrites79.3%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot \mathsf{fma}\left(-0.5, \cos \left(\mathsf{fma}\left(0.011111111111111112, \pi \cdot angle, 1 \cdot \pi\right)\right), 0.5\right), b, {\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}^{2}\right)} \]
  10. Add Preprocessing

Alternative 5: 79.2% accurate, 1.1× speedup?

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

\\
\mathsf{fma}\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(angle\_m \cdot 0.005555555555555556\right) \cdot \pi\right)\right), b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right) \cdot a\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 79.3%

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{\frac{180}{angle}} \cdot \pi\right) \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{angle}} \cdot \pi\right)}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

Alternative 6: 79.2% accurate, 1.1× speedup?

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

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

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

      \[\leadsto {\color{blue}{\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.2% accurate, 1.8× speedup?

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

\\
\mathsf{fma}\left(1, b \cdot b, {\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\_m\right) \cdot a\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 79.3%

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

      \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
  5. Applied rewrites79.3%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\pi \cdot \frac{1}{\color{blue}{\frac{180}{angle}}}\right) \cdot a\right)}^{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(\frac{1}{180} \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
    13. lower-*.f6479.3

      \[\leadsto \mathsf{fma}\left({\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}^{2}, b \cdot b, {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right)} \cdot angle\right) \cdot a\right)}^{2}\right) \]
  7. Applied rewrites79.3%

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

    \[\leadsto \mathsf{fma}\left(\color{blue}{1}, b \cdot b, {\left(\sin \left(\left(\frac{1}{180} \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right) \]
  9. Step-by-step derivation
    1. Applied rewrites79.3%

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

    Alternative 8: 79.2% accurate, 1.8× speedup?

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

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

        \[\leadsto \color{blue}{{\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. +-commutativeN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{1}, b \cdot b, {\left(\sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) \cdot a\right)}^{2}\right) \]
    5. Step-by-step derivation
      1. Applied rewrites79.2%

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

      Alternative 9: 57.1% accurate, 29.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 =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(a, b, angle_m)
      use fmin_fmax_functions
          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 79.3%

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

        \[\leadsto \color{blue}{{b}^{2}} \]
      3. Step-by-step derivation
        1. lower-pow.f6457.1

          \[\leadsto {b}^{\color{blue}{2}} \]
      4. Applied rewrites57.1%

        \[\leadsto \color{blue}{{b}^{2}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto {b}^{\color{blue}{2}} \]
        2. pow2N/A

          \[\leadsto b \cdot \color{blue}{b} \]
        3. lift-*.f6457.1

          \[\leadsto b \cdot \color{blue}{b} \]
      6. Applied rewrites57.1%

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

      Reproduce

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