ab-angle->ABCF C

Percentage Accurate: 79.1% → 79.1%
Time: 6.6s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 79.1% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    9. lift-PI.f6479.1

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

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

Alternative 3: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {\left(a \cdot \sin \left(\left(-\pi \cdot \color{blue}{\left(\frac{1}{180} \cdot angle\right)}\right) + \frac{\pi}{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  5. Step-by-step derivation
    1. lower-*.f6479.1

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

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

    \[\leadsto {\left(a \cdot \sin \left(\left(-\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right) + \frac{\pi}{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(\frac{1}{180} \cdot angle\right)}\right)\right)}^{2} \]
  8. Step-by-step derivation
    1. lower-*.f6479.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\mathsf{fma}\left(\mathsf{PI}\left(\right), \frac{1}{180} \cdot angle, \frac{\pi}{2}\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)}^{2} \]
    15. lift-PI.f6479.1

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

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

Alternative 4: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\mathsf{fma}\left(\frac{-1}{180}, \pi \cdot angle, \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lift-PI.f6479.0

      \[\leadsto {\left(a \cdot \sin \left(\mathsf{fma}\left(-0.005555555555555556, \pi \cdot angle, 0.5 \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  6. Applied rewrites79.0%

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

Alternative 5: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.1% accurate, 1.0× speedup?

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

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

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

Alternative 7: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 8: 79.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \]
  7. Applied rewrites79.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 79.0% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 57.4% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 2.5 \cdot 10^{-33}:\\ \;\;\;\;\mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot b\right) \cdot b, \pi \cdot \pi, \left(\pi \cdot \pi\right) \cdot \left(\left(-3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(0.5 - \cos \left(\left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot 0.5\right) \cdot b, b, \left(1 \cdot a\right) \cdot \left(1 \cdot a\right)\right)\\ \end{array} \end{array} \]
    (FPCore (a b angle)
     :precision binary64
     (if (<= a 2.5e-33)
       (fma
        a
        a
        (*
         (* angle angle)
         (fma
          (* (* 3.08641975308642e-5 b) b)
          (* PI PI)
          (* (* PI PI) (* (* -3.08641975308642e-5 a) a)))))
       (fma
        (* (- 0.5 (* (cos (* (* (/ angle 180.0) PI) 2.0)) 0.5)) b)
        b
        (* (* 1.0 a) (* 1.0 a)))))
    double code(double a, double b, double angle) {
    	double tmp;
    	if (a <= 2.5e-33) {
    		tmp = fma(a, a, ((angle * angle) * fma(((3.08641975308642e-5 * b) * b), (((double) M_PI) * ((double) M_PI)), ((((double) M_PI) * ((double) M_PI)) * ((-3.08641975308642e-5 * a) * a)))));
    	} else {
    		tmp = fma(((0.5 - (cos((((angle / 180.0) * ((double) M_PI)) * 2.0)) * 0.5)) * b), b, ((1.0 * a) * (1.0 * a)));
    	}
    	return tmp;
    }
    
    function code(a, b, angle)
    	tmp = 0.0
    	if (a <= 2.5e-33)
    		tmp = fma(a, a, Float64(Float64(angle * angle) * fma(Float64(Float64(3.08641975308642e-5 * b) * b), Float64(pi * pi), Float64(Float64(pi * pi) * Float64(Float64(-3.08641975308642e-5 * a) * a)))));
    	else
    		tmp = fma(Float64(Float64(0.5 - Float64(cos(Float64(Float64(Float64(angle / 180.0) * pi) * 2.0)) * 0.5)) * b), b, Float64(Float64(1.0 * a) * Float64(1.0 * a)));
    	end
    	return tmp
    end
    
    code[a_, b_, angle_] := If[LessEqual[a, 2.5e-33], N[(a * a + N[(N[(angle * angle), $MachinePrecision] * N[(N[(N[(3.08641975308642e-5 * b), $MachinePrecision] * b), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(-3.08641975308642e-5 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 - N[(N[Cos[N[(N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b + N[(N[(1.0 * a), $MachinePrecision] * N[(1.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq 2.5 \cdot 10^{-33}:\\
    \;\;\;\;\mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot b\right) \cdot b, \pi \cdot \pi, \left(\pi \cdot \pi\right) \cdot \left(\left(-3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot a\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\left(0.5 - \cos \left(\left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot 0.5\right) \cdot b, b, \left(1 \cdot a\right) \cdot \left(1 \cdot a\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < 2.50000000000000014e-33

      1. Initial program 79.1%

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

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

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

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

        \[\leadsto \color{blue}{a \cdot a} \]
      5. Taylor expanded in angle around 0

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a, a, {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \]
        5. pow2N/A

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

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

          \[\leadsto \mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \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)\right) \]
      7. Applied rewrites40.9%

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

      if 2.50000000000000014e-33 < a

      1. Initial program 79.1%

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

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

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

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

      Alternative 11: 54.4% accurate, 2.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 1.42 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot b\right) \cdot b, \pi \cdot \pi, \left(\pi \cdot \pi\right) \cdot \left(\left(-3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(3.175328964080679 \cdot 10^{-10} \cdot \left(angle \cdot angle\right), \left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot \pi, \left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), angle \cdot angle, 1\right) \cdot \left(a \cdot a\right)\\ \end{array} \end{array} \]
      (FPCore (a b angle)
       :precision binary64
       (if (<= a 1.42e-14)
         (fma
          a
          a
          (*
           (* angle angle)
           (fma
            (* (* 3.08641975308642e-5 b) b)
            (* PI PI)
            (* (* PI PI) (* (* -3.08641975308642e-5 a) a)))))
         (*
          (fma
           (fma
            (* 3.175328964080679e-10 (* angle angle))
            (* (* (* PI PI) PI) PI)
            (* (* PI PI) -3.08641975308642e-5))
           (* angle angle)
           1.0)
          (* a a))))
      double code(double a, double b, double angle) {
      	double tmp;
      	if (a <= 1.42e-14) {
      		tmp = fma(a, a, ((angle * angle) * fma(((3.08641975308642e-5 * b) * b), (((double) M_PI) * ((double) M_PI)), ((((double) M_PI) * ((double) M_PI)) * ((-3.08641975308642e-5 * a) * a)))));
      	} else {
      		tmp = fma(fma((3.175328964080679e-10 * (angle * angle)), (((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * ((double) M_PI)), ((((double) M_PI) * ((double) M_PI)) * -3.08641975308642e-5)), (angle * angle), 1.0) * (a * a);
      	}
      	return tmp;
      }
      
      function code(a, b, angle)
      	tmp = 0.0
      	if (a <= 1.42e-14)
      		tmp = fma(a, a, Float64(Float64(angle * angle) * fma(Float64(Float64(3.08641975308642e-5 * b) * b), Float64(pi * pi), Float64(Float64(pi * pi) * Float64(Float64(-3.08641975308642e-5 * a) * a)))));
      	else
      		tmp = Float64(fma(fma(Float64(3.175328964080679e-10 * Float64(angle * angle)), Float64(Float64(Float64(pi * pi) * pi) * pi), Float64(Float64(pi * pi) * -3.08641975308642e-5)), Float64(angle * angle), 1.0) * Float64(a * a));
      	end
      	return tmp
      end
      
      code[a_, b_, angle_] := If[LessEqual[a, 1.42e-14], N[(a * a + N[(N[(angle * angle), $MachinePrecision] * N[(N[(N[(3.08641975308642e-5 * b), $MachinePrecision] * b), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(-3.08641975308642e-5 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.175328964080679e-10 * N[(angle * angle), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision] + 1.0), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq 1.42 \cdot 10^{-14}:\\
      \;\;\;\;\mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot b\right) \cdot b, \pi \cdot \pi, \left(\pi \cdot \pi\right) \cdot \left(\left(-3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot a\right)\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(3.175328964080679 \cdot 10^{-10} \cdot \left(angle \cdot angle\right), \left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot \pi, \left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), angle \cdot angle, 1\right) \cdot \left(a \cdot a\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < 1.42000000000000004e-14

        1. Initial program 79.1%

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

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

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

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

          \[\leadsto \color{blue}{a \cdot a} \]
        5. Taylor expanded in angle around 0

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

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

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

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

            \[\leadsto \mathsf{fma}\left(a, a, {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \]
          5. pow2N/A

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

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

            \[\leadsto \mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \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)\right) \]
        7. Applied rewrites40.9%

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

        if 1.42000000000000004e-14 < a

        1. Initial program 79.1%

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

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

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

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

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

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

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

      Alternative 12: 53.4% accurate, 2.8× speedup?

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

        1. Initial program 79.1%

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

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

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

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

          \[\leadsto \color{blue}{a \cdot a} \]
        5. Taylor expanded in angle around 0

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

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

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

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

            \[\leadsto \mathsf{fma}\left(a, a, {angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right) \]
          5. pow2N/A

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

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

            \[\leadsto \mathsf{fma}\left(a, a, \left(angle \cdot angle\right) \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)\right) \]
        7. Applied rewrites40.9%

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

        if 3.6e6 < a

        1. Initial program 79.1%

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

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

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

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

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

      Alternative 13: 53.0% accurate, 2.8× speedup?

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

        1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

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

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

        if 3.6e6 < a

        1. Initial program 79.1%

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

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

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

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

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

      Alternative 14: 52.9% accurate, 29.7× speedup?

      \[\begin{array}{l} \\ a \cdot a \end{array} \]
      (FPCore (a b angle) :precision binary64 (* a a))
      double code(double a, double b, double angle) {
      	return a * a;
      }
      
      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)
      use fmin_fmax_functions
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8), intent (in) :: angle
          code = a * a
      end function
      
      public static double code(double a, double b, double angle) {
      	return a * a;
      }
      
      def code(a, b, angle):
      	return a * a
      
      function code(a, b, angle)
      	return Float64(a * a)
      end
      
      function tmp = code(a, b, angle)
      	tmp = a * a;
      end
      
      code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      a \cdot a
      \end{array}
      
      Derivation
      1. Initial program 79.1%

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

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

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

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

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

      Reproduce

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