ab-angle->ABCF C

Percentage Accurate: 79.5% → 79.5%
Time: 26.5s
Alternatives: 13
Speedup: 1.5×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 79.5% 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.5% accurate, 0.8× speedup?

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

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

    \[{\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
  3. Step-by-step derivation
    1. clear-num80.4%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{\pi}{180} \cdot angle\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} \]
    2. add-sqr-sqrt34.5%

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

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

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

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

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

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

Alternative 2: 79.5% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \cos \left(\frac{\pi}{-180} \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{-180} \cdot angle\right)\right)}^{2}} \]
  3. Add Preprocessing
  4. Taylor expanded in angle around inf 80.4%

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

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

Alternative 3: 79.4% accurate, 1.0× speedup?

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

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

    \[{\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
  3. Step-by-step derivation
    1. clear-num80.4%

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

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

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

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

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

Alternative 4: 79.5% accurate, 1.0× speedup?

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

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

    \[{\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
  3. Step-by-step derivation
    1. clear-num80.4%

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

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

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

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

Alternative 5: 79.5% accurate, 1.0× speedup?

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

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

    \[{\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
  3. Step-by-step derivation
    1. clear-num80.4%

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

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

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

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

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

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

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

Alternative 6: 79.5% accurate, 1.5× speedup?

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

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

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

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

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

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

Alternative 7: 79.6% accurate, 1.5× speedup?

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

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

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

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

    \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} \]
  5. Step-by-step derivation
    1. associate-*r*79.8%

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

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

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

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

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

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

Alternative 8: 79.5% accurate, 1.5× speedup?

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

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

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

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

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

Alternative 9: 79.6% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\sqrt{\frac{\left(\pi \cdot angle\right) \cdot \left(\pi \cdot angle\right)}{\color{blue}{32400}}}\right)\right)}^{2} \]
    7. metadata-eval56.1%

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\sqrt{\frac{\pi}{-180} \cdot angle} \cdot \sqrt{\frac{\pi}{-180} \cdot angle}\right)}\right)}^{2} \]
    12. add-sqr-sqrt79.8%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(angle \cdot \frac{\pi}{-180}\right)}\right)}^{2} \]
    14. clear-num79.8%

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

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

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

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

Alternative 10: 79.5% accurate, 1.5× speedup?

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

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

    \[{\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
  3. Step-by-step derivation
    1. clear-num80.4%

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

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

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

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

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

Alternative 11: 74.2% accurate, 2.0× speedup?

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

\\
{a}^{2} + \left(\left(angle_m \cdot b\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(angle_m \cdot b\right)\right)\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}
\end{array}
Derivation
  1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {a}^{2} + \left(\left(angle \cdot b\right) \cdot \left(\pi \cdot \left(\pi \cdot \left(angle \cdot b\right)\right)\right)\right) \cdot 3.08641975308642 \cdot 10^{-5} \]
  12. Add Preprocessing

Alternative 12: 74.1% accurate, 2.0× speedup?

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

\\
{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle_m \cdot \left(\pi \cdot b\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(\pi \cdot b\right)\right)}^{2} \]
  13. Add Preprocessing

Alternative 13: 74.2% accurate, 2.0× speedup?

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

\\
{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(\pi \cdot \left(angle_m \cdot b\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(\pi \cdot \left(angle \cdot b\right)\right)}^{2} \]
  10. Add Preprocessing

Reproduce

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