ab-angle->ABCF A

Percentage Accurate: 80.0% → 79.9%
Time: 17.6s
Alternatives: 7
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 7 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 79.9% accurate, 2.0× speedup?

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

\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + b \cdot b
\end{array}
Derivation
  1. Initial program 74.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. unpow274.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/74.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*74.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. unpow274.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. Simplified74.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 75.2%

    \[\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. associate-*r/75.2%

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

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

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

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

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

Alternative 2: 80.0% 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 74.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. unpow274.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/74.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*74.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. unpow274.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. Simplified74.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 75.2%

    \[\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-identity75.2%

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

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

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

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

Alternative 3: 66.2% accurate, 3.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.8 \cdot 10^{+86}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 72.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. unpow272.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/72.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) \cdot \left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right) \]
      3. associate-/l*72.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. unpow272.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. Simplified72.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 59.1%

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

    if 2.80000000000000004e86 < a

    1. Initial program 87.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. unpow287.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/87.4%

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

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

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

      \[\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.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. associate-*r/87.4%

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

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

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

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

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

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

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

Alternative 4: 62.7% accurate, 3.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.08 \cdot 10^{+108}:\\
\;\;\;\;{b}^{2}\\

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


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

    1. Initial program 72.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. unpow272.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/72.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*72.2%

        \[\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. unpow272.2%

        \[\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. Simplified72.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 58.3%

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

    if 1.0800000000000001e108 < a

    1. Initial program 93.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. unpow293.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/94.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*93.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. unpow293.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. Simplified93.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 a around inf 64.9%

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow264.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-sqr77.7%

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

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

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

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

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

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

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

Alternative 5: 62.8% accurate, 3.9× speedup?

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

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

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


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

    1. Initial program 72.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. unpow272.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/72.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*72.2%

        \[\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. unpow272.2%

        \[\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. Simplified72.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 58.3%

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

    if 5.4999999999999998e109 < a

    1. Initial program 93.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. unpow293.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/94.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*93.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. unpow293.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. Simplified93.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 a around inf 64.9%

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow264.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-sqr77.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \color{blue}{\left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot 0.005555555555555556\right)} \]
      6. associate-*l*80.0%

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

        \[\leadsto \left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}\right) \]
    10. Applied egg-rr79.9%

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

Alternative 6: 38.3% accurate, 27.8× speedup?

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

\\
\begin{array}{l}
t_0 := a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 74.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. unpow274.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/74.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*74.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. unpow274.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. Simplified74.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 a around inf 30.3%

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

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

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

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

      \[\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-sqr35.9%

      \[\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. unpow235.9%

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

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

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

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

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

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

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

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

      \[\leadsto \left(a \cdot \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}\right) \cdot \left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right) \]
    5. *-commutative37.7%

      \[\leadsto \left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \color{blue}{\left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot 0.005555555555555556\right)} \]
    6. associate-*l*37.6%

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

      \[\leadsto \left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}\right) \]
  10. Applied egg-rr37.6%

    \[\leadsto \color{blue}{\left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
  11. Add Preprocessing

Alternative 7: 38.3% accurate, 27.8× speedup?

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

\\
0.005555555555555556 \cdot \left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)
\end{array}
Derivation
  1. Initial program 74.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. unpow274.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/74.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*74.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. unpow274.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. Simplified74.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 a around inf 30.3%

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

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

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

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

      \[\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-sqr35.9%

      \[\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. unpow235.9%

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

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

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

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

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

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

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

      \[\leadsto 0.005555555555555556 \cdot \left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot 0.005555555555555556\right)}\right) \]
    4. associate-*l*37.3%

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

      \[\leadsto 0.005555555555555556 \cdot \left(\left(a \cdot \left(angle \cdot \pi\right)\right) \cdot \left(a \cdot \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}\right)\right) \]
  10. Applied egg-rr37.3%

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

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

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

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

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

Reproduce

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