ab-angle->ABCF A

Percentage Accurate: 80.1% → 80.0%
Time: 30.9s
Alternatives: 10
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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: 80.1% 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: 80.0% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)}\right)}^{2} \]
    6. expm1-undefine68.5%

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)} - 1\right)}\right)}^{2} \]
    7. cos-diff68.4%

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\left(\cos \left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right) \cdot \cos 1 + \sin \left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right) \cdot \sin 1\right)}\right)}^{2} \]
  8. Applied egg-rr82.2%

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

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

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

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left(\cos \left(\mathsf{fma}\left(angle \cdot \pi, 0.005555555555555556, 1\right)\right), \cos 1, \sin \color{blue}{\left(\mathsf{fma}\left(angle \cdot \pi, 0.005555555555555556, 1\right)\right)} \cdot \sin 1\right)\right)}^{2} \]
  10. Simplified82.2%

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

Alternative 2: 80.0% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)}\right)}^{2} \]
    6. expm1-undefine68.5%

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)} - 1\right)}\right)}^{2} \]
    7. cos-diff68.4%

      \[\leadsto {\left(a \cdot \sin \left({\left(\frac{\frac{180}{angle}}{\pi}\right)}^{-1}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\left(\cos \left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right) \cdot \cos 1 + \sin \left(e^{\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right) \cdot \sin 1\right)}\right)}^{2} \]
  8. Applied egg-rr82.2%

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

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

Alternative 3: 80.0% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\\
t_1 := \cos t\_0\\
\mathsf{fma}\left(t\_1 \cdot \left(b \cdot t\_1\right), b, {\left(a \cdot \sin t\_0\right)}^{2}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 81.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. associate-*l/82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
    4. distribute-lft-neg-out82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out82.1%

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

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

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

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

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

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

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

Alternative 5: 80.1% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 80.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 81.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. associate-*l/82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
    4. distribute-lft-neg-out82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right), \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot b\right)\right)}^{2}} \]
  7. Final simplification82.2%

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

Alternative 7: 80.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 80.2% accurate, 1.3× speedup?

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

\\
\mathsf{fma}\left(b, b, {\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 81.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. associate-*l/82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
    4. distribute-lft-neg-out82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out82.1%

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

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

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

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

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

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

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

Alternative 9: 63.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.2 \cdot 10^{+106}:\\
\;\;\;\;b \cdot b\\

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 7.2000000000000002e106

    1. Initial program 79.2%

      \[{\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. associate-*l/79.6%

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
      4. distribute-lft-neg-out79.7%

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out79.7%

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]
    6. Step-by-step derivation
      1. unpow261.5%

        \[\leadsto \color{blue}{b \cdot b} \]
    7. Applied egg-rr61.5%

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

    if 7.2000000000000002e106 < a

    1. Initial program 92.9%

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
      4. distribute-lft-neg-out92.8%

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

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

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
      7. distribute-lft-neg-out92.8%

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\log \left({\left(\mathsf{hypot}\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right), \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot b\right)\right)}^{2}\right)}} \]
    6. Applied egg-rr56.5%

      \[\leadsto \color{blue}{\log \left(e^{{\left(\mathsf{hypot}\left(\cos \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot b, a \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right)}^{2}}\right)} \]
    7. Taylor expanded in b around 0 56.5%

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

        \[\leadsto \color{blue}{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \cdot {a}^{2}} \]
      2. associate-*r*56.4%

        \[\leadsto {\sin \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)}}^{2} \cdot {a}^{2} \]
      3. *-commutative56.4%

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

        \[\leadsto {\sin \color{blue}{\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}}^{2} \cdot {a}^{2} \]
      5. unpow256.4%

        \[\leadsto \color{blue}{\left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)} \cdot {a}^{2} \]
      6. unpow256.4%

        \[\leadsto \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right) \cdot \color{blue}{\left(a \cdot a\right)} \]
      7. swap-sqr73.1%

        \[\leadsto \color{blue}{\left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot a\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot a\right)} \]
      8. unpow273.1%

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

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

        \[\leadsto {\left(\sin \left(\color{blue}{\left(0.005555555555555556 \cdot angle\right)} \cdot \pi\right) \cdot a\right)}^{2} \]
      11. associate-*r*73.2%

        \[\leadsto {\left(\sin \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot a\right)}^{2} \]
      12. *-commutative73.2%

        \[\leadsto {\color{blue}{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}}^{2} \]
    9. Simplified73.2%

      \[\leadsto \color{blue}{{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 7.2 \cdot 10^{+106}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;{\left(a \cdot \sin \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 57.7% accurate, 139.0× speedup?

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

\\
b \cdot b
\end{array}
Derivation
  1. Initial program 81.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. associate-*l/82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{\cos \left(-\frac{angle}{180} \cdot \pi\right)}\right)}^{2} \]
    4. distribute-lft-neg-out82.1%

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(-\frac{angle}{180}\right)} \cdot \pi\right)\right)}^{2} \]
    7. distribute-lft-neg-out82.1%

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

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

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

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

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

    \[\leadsto \color{blue}{{b}^{2}} \]
  6. Step-by-step derivation
    1. unpow256.6%

      \[\leadsto \color{blue}{b \cdot b} \]
  7. Applied egg-rr56.6%

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

Reproduce

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