ab-angle->ABCF A

Percentage Accurate: 79.6% → 79.5%
Time: 15.2s
Alternatives: 6
Speedup: N/A×

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

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

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

Alternative 1: 79.5% accurate, 1.3× speedup?

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

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

    \[{\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. unpow282.1%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
    2. associate-*l/82.0%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    3. 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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    4. unpow282.1%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \color{blue}{{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 58.7% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{-149}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 9.50000000000000034e-149

    1. Initial program 79.1%

      \[{\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. unpow279.1%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/78.9%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*79.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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow279.1%

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

      \[\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 a around inf 43.8%

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

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

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

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

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

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

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

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

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

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

    if 9.50000000000000034e-149 < b

    1. Initial program 86.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. unpow286.9%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/86.9%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*87.0%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow287.0%

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

      \[\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 87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.5% accurate, 2.0× speedup?

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

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

    \[{\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. unpow282.1%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
    2. associate-*l/82.0%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    3. 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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    4. unpow282.1%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \color{blue}{{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 82.4%

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

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

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

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

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

Alternative 4: 66.0% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 6.9 \cdot 10^{-99}:\\ \;\;\;\;{b}^{2}\\ \mathbf{else}:\\ \;\;\;\;b \cdot b + {\left(angle \cdot \left(\pi \cdot \left(a \cdot 0.005555555555555556\right)\right)\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (if (<= a 6.9e-99)
   (pow b 2.0)
   (+ (* b b) (pow (* angle (* PI (* a 0.005555555555555556))) 2.0))))
double code(double a, double b, double angle) {
	double tmp;
	if (a <= 6.9e-99) {
		tmp = pow(b, 2.0);
	} else {
		tmp = (b * b) + pow((angle * (((double) M_PI) * (a * 0.005555555555555556))), 2.0);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double tmp;
	if (a <= 6.9e-99) {
		tmp = Math.pow(b, 2.0);
	} else {
		tmp = (b * b) + Math.pow((angle * (Math.PI * (a * 0.005555555555555556))), 2.0);
	}
	return tmp;
}
def code(a, b, angle):
	tmp = 0
	if a <= 6.9e-99:
		tmp = math.pow(b, 2.0)
	else:
		tmp = (b * b) + math.pow((angle * (math.pi * (a * 0.005555555555555556))), 2.0)
	return tmp
function code(a, b, angle)
	tmp = 0.0
	if (a <= 6.9e-99)
		tmp = b ^ 2.0;
	else
		tmp = Float64(Float64(b * b) + (Float64(angle * Float64(pi * Float64(a * 0.005555555555555556))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	tmp = 0.0;
	if (a <= 6.9e-99)
		tmp = b ^ 2.0;
	else
		tmp = (b * b) + ((angle * (pi * (a * 0.005555555555555556))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := If[LessEqual[a, 6.9e-99], N[Power[b, 2.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(angle * N[(Pi * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 6.9 \cdot 10^{-99}:\\
\;\;\;\;{b}^{2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 6.9000000000000003e-99

    1. Initial program 82.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. unpow282.2%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/82.2%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*82.3%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow282.3%

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

      \[\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 60.3%

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 6.9000000000000003e-99 < a

    1. Initial program 81.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. unpow281.9%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/81.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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*81.9%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow281.9%

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

      \[\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 82.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(angle \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot a\right) \cdot \pi\right)}\right)}^{2} + b \cdot b \]
      6. *-commutative78.0%

        \[\leadsto {\left(angle \cdot \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot a\right)\right)}\right)}^{2} + b \cdot b \]
    10. Simplified78.0%

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

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

Alternative 5: 61.2% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\ \mathbf{if}\;a \leq 1.6 \cdot 10^{+69}:\\ \;\;\;\;{b}^{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot t\_0\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* 0.005555555555555556 (* a (* PI angle)))))
   (if (<= a 1.6e+69) (pow b 2.0) (* t_0 t_0))))
double code(double a, double b, double angle) {
	double t_0 = 0.005555555555555556 * (a * (((double) M_PI) * angle));
	double tmp;
	if (a <= 1.6e+69) {
		tmp = pow(b, 2.0);
	} else {
		tmp = t_0 * t_0;
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double t_0 = 0.005555555555555556 * (a * (Math.PI * angle));
	double tmp;
	if (a <= 1.6e+69) {
		tmp = Math.pow(b, 2.0);
	} else {
		tmp = t_0 * t_0;
	}
	return tmp;
}
def code(a, b, angle):
	t_0 = 0.005555555555555556 * (a * (math.pi * angle))
	tmp = 0
	if a <= 1.6e+69:
		tmp = math.pow(b, 2.0)
	else:
		tmp = t_0 * t_0
	return tmp
function code(a, b, angle)
	t_0 = Float64(0.005555555555555556 * Float64(a * Float64(pi * angle)))
	tmp = 0.0
	if (a <= 1.6e+69)
		tmp = b ^ 2.0;
	else
		tmp = Float64(t_0 * t_0);
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	t_0 = 0.005555555555555556 * (a * (pi * angle));
	tmp = 0.0;
	if (a <= 1.6e+69)
		tmp = b ^ 2.0;
	else
		tmp = t_0 * t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 1.6e+69], N[Power[b, 2.0], $MachinePrecision], N[(t$95$0 * t$95$0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;a \leq 1.6 \cdot 10^{+69}:\\
\;\;\;\;{b}^{2}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_0\\


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

    1. Initial program 79.7%

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

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/79.7%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*79.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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow279.8%

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \color{blue}{{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}} \]
    3. Simplified79.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. Taylor expanded in angle around 0 60.6%

      \[\leadsto \color{blue}{{b}^{2}} \]

    if 1.59999999999999992e69 < a

    1. Initial program 91.6%

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

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
      2. associate-*l/91.3%

        \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*91.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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      4. unpow291.7%

        \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \color{blue}{{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}} \]
    3. Simplified91.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 a around inf 59.4%

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr67.3%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow267.3%

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

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

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

      \[\leadsto \color{blue}{{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}} \]
    8. Taylor expanded in angle around 0 72.0%

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

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

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

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\pi \cdot \color{blue}{\left(angle \cdot a\right)}\right)\right)}^{2} \]
    10. Simplified72.0%

      \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} \]
    11. Step-by-step derivation
      1. unpow-prod-down70.3%

        \[\leadsto \color{blue}{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
      2. add-sqr-sqrt70.3%

        \[\leadsto \color{blue}{\sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}}} \]
      3. unpow-prod-down70.3%

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

        \[\leadsto \color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
      5. metadata-eval27.2%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\color{blue}{1}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
      6. pow127.2%

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

        \[\leadsto \left(0.005555555555555556 \cdot \color{blue}{\left(\left(\pi \cdot angle\right) \cdot a\right)}\right) \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
      8. unpow-prod-down28.9%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \sqrt{\color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2}}} \]
      9. sqrt-pow172.0%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\left(\frac{2}{2}\right)}} \]
      10. metadata-eval72.0%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\color{blue}{1}} \]
      11. pow172.0%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} \]
      12. associate-*r*72.0%

        \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{\left(\left(\pi \cdot angle\right) \cdot a\right)}\right) \]
    12. Applied egg-rr72.0%

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

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

Alternative 6: 39.1% accurate, 27.8× speedup?

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

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 82.1%

    \[{\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. unpow282.1%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)} \]
    2. associate-*l/82.0%

      \[\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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    3. 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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
    4. unpow282.1%

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \color{blue}{{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 a around inf 36.4%

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

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

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

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

      \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
    5. swap-sqr41.6%

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

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

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

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

    \[\leadsto \color{blue}{{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}} \]
  8. Taylor expanded in angle around 0 40.4%

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

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

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

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

    \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}}^{2} \]
  11. Step-by-step derivation
    1. unpow-prod-down39.8%

      \[\leadsto \color{blue}{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
    2. add-sqr-sqrt39.8%

      \[\leadsto \color{blue}{\sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}}} \]
    3. unpow-prod-down39.8%

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

      \[\leadsto \color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
    5. metadata-eval19.6%

      \[\leadsto {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\color{blue}{1}} \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
    6. pow119.6%

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

      \[\leadsto \left(0.005555555555555556 \cdot \color{blue}{\left(\left(\pi \cdot angle\right) \cdot a\right)}\right) \cdot \sqrt{{0.005555555555555556}^{2} \cdot {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2}} \]
    8. unpow-prod-down20.2%

      \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \sqrt{\color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{2}}} \]
    9. sqrt-pow140.5%

      \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \color{blue}{{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\left(\frac{2}{2}\right)}} \]
    10. metadata-eval40.5%

      \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)}^{\color{blue}{1}} \]
    11. pow140.5%

      \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(angle \cdot a\right)\right)\right)} \]
    12. associate-*r*40.4%

      \[\leadsto \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{\left(\left(\pi \cdot angle\right) \cdot a\right)}\right) \]
  12. Applied egg-rr40.4%

    \[\leadsto \color{blue}{\left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right) \cdot \left(0.005555555555555556 \cdot \left(\left(\pi \cdot angle\right) \cdot a\right)\right)} \]
  13. Final simplification40.4%

    \[\leadsto \left(0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\right) \cdot \left(0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\right) \]
  14. Add Preprocessing

Reproduce

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