ab-angle->ABCF A

Percentage Accurate: 79.8% → 79.9%
Time: 4.3s
Alternatives: 9
Speedup: 0.9×

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\frac{1}{0.005555555555555556 \cdot angle}} \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 (* (/ 1.0 (/ 1.0 (* 0.005555555555555556 angle))) 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 = (1.0 / (1.0 / (0.005555555555555556 * angle))) * ((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 = (1.0 / (1.0 / (0.005555555555555556 * angle))) * 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 = (1.0 / (1.0 / (0.005555555555555556 * angle))) * 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(1.0 / Float64(1.0 / Float64(0.005555555555555556 * angle))) * 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 = (1.0 / (1.0 / (0.005555555555555556 * angle))) * 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[(1.0 / N[(1.0 / N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]), $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{1}{\frac{1}{0.005555555555555556 \cdot angle}} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\frac{1}{angle} \cdot 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 (* (/ 1.0 (* (/ 1.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 = (1.0 / ((1.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 = (1.0 / ((1.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 = (1.0 / ((1.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(1.0 / Float64(Float64(1.0 / 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 = (1.0 / ((1.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[(1.0 / N[(N[(1.0 / angle), $MachinePrecision] * 180.0), $MachinePrecision]), $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{1}{\frac{1}{angle} \cdot 180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.005555555555555556 \cdot \frac{1}{\frac{1}{angle}}\right) \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 (* (* 0.005555555555555556 (/ 1.0 (/ 1.0 angle))) 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 = (0.005555555555555556 * (1.0 / (1.0 / angle))) * ((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 = (0.005555555555555556 * (1.0 / (1.0 / angle))) * 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 = (0.005555555555555556 * (1.0 / (1.0 / angle))) * 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(0.005555555555555556 * Float64(1.0 / Float64(1.0 / angle))) * 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 = (0.005555555555555556 * (1.0 / (1.0 / angle))) * 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[(0.005555555555555556 * N[(1.0 / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]), $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 := \left(0.005555555555555556 \cdot \frac{1}{\frac{1}{angle}}\right) \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 79.8% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{1}{\frac{1}{180} \cdot angle}} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
    4. metadata-evalN/A

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{1}{\frac{1}{180} \cdot angle}} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
    5. mult-flipN/A

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{1}{\frac{1}{180} \cdot angle}} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
    6. associate-/l*N/A

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{1}{\frac{1}{\frac{1}{180} \cdot angle}} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
    9. mult-flipN/A

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

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

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

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

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

Alternative 6: 79.8% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 57.6% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.15 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(b, b, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right), \pi \cdot \pi, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.15e102

    1. Initial program 77.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, b, \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) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, b, \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. associate-*r*N/A

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

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

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

    if 2.15e102 < b

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}} \]
    11. Applied rewrites86.8%

      \[\leadsto \color{blue}{\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right) \cdot \left(b \cdot b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 53.3% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.15 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(b, b, \left(angle \cdot angle\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right), \pi \cdot \pi, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.15e102

    1. Initial program 77.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, b, \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) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, b, \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. associate-*r*N/A

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

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

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

    if 2.15e102 < b

    1. Initial program 91.6%

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

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

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

        \[\leadsto b \cdot \color{blue}{b} \]
    4. Applied rewrites87.1%

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

Alternative 9: 53.3% accurate, 29.7× speedup?

\[\begin{array}{l} \\ b \cdot b \end{array} \]
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
	return b * b;
}
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 = b * b
end function
public static double code(double a, double b, double angle) {
	return b * b;
}
def code(a, b, angle):
	return b * b
function code(a, b, angle)
	return Float64(b * b)
end
function tmp = code(a, b, angle)
	tmp = b * b;
end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

Reproduce

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