ab-angle->ABCF C

Percentage Accurate: 79.6% → 79.4%
Time: 1.3min
Alternatives: 6
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

Alternative 1: 79.4% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2} \]
  5. Taylor expanded in angle around inf 81.0%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left|{\left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)}^{\left(\frac{1}{2}\right)}\right|\right)}\right)}^{2} \]
    7. sqr-pow81.0%

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left|\color{blue}{\left(-0.005555555555555556 \cdot \pi\right) \cdot angle}\right|\right)\right)}^{2} \]
    12. fabs-mul81.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left|-0.005555555555555556 \cdot \pi\right| \cdot \left|angle\right|\right)}\right)}^{2} \]
    13. fabs-mul81.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(\left|-0.005555555555555556\right| \cdot \left|\pi\right|\right)} \cdot \left|angle\right|\right)\right)}^{2} \]
    14. metadata-eval81.1%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \left|\color{blue}{{\pi}^{1}}\right|\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    16. sqr-pow80.7%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \left|\color{blue}{{\pi}^{\left(\frac{1}{2}\right)} \cdot {\pi}^{\left(\frac{1}{2}\right)}}\right|\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    17. fabs-sqr80.7%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \color{blue}{\left({\pi}^{\left(\frac{1}{2}\right)} \cdot {\pi}^{\left(\frac{1}{2}\right)}\right)}\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    18. sqr-pow81.1%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left|\color{blue}{{angle}^{1}}\right|\right)\right)}^{2} \]
    21. sqr-pow38.9%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left|\color{blue}{{angle}^{\left(\frac{1}{2}\right)} \cdot {angle}^{\left(\frac{1}{2}\right)}}\right|\right)\right)}^{2} \]
    22. fabs-sqr38.9%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \color{blue}{\left({angle}^{\left(\frac{1}{2}\right)} \cdot {angle}^{\left(\frac{1}{2}\right)}\right)}\right)\right)}^{2} \]
    23. sqr-pow81.1%

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

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

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

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

Alternative 2: 79.3% accurate, 1.5× speedup?

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

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

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

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

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

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

Alternative 3: 74.3% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {a}^{2} + 0.005555555555555556 \cdot \left(\left(\pi \cdot \left(angle \cdot \left(b \cdot 0.005555555555555556\right)\right)\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right) \]

Alternative 4: 74.3% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {a}^{2} + \pi \cdot \left(\left(angle \cdot \left(b \cdot 0.005555555555555556\right)\right) \cdot \left(\pi \cdot \left(angle \cdot \left(b \cdot 0.005555555555555556\right)\right)\right)\right) \]

Alternative 5: 74.3% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2} \]
  5. Taylor expanded in angle around inf 81.0%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left|{\left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)}^{\left(\frac{1}{2}\right)}\right|\right)}\right)}^{2} \]
    7. sqr-pow81.0%

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left|\color{blue}{\left(-0.005555555555555556 \cdot \pi\right) \cdot angle}\right|\right)\right)}^{2} \]
    12. fabs-mul81.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left|-0.005555555555555556 \cdot \pi\right| \cdot \left|angle\right|\right)}\right)}^{2} \]
    13. fabs-mul81.1%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\color{blue}{\left(\left|-0.005555555555555556\right| \cdot \left|\pi\right|\right)} \cdot \left|angle\right|\right)\right)}^{2} \]
    14. metadata-eval81.1%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \left|\color{blue}{{\pi}^{1}}\right|\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    16. sqr-pow80.7%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \left|\color{blue}{{\pi}^{\left(\frac{1}{2}\right)} \cdot {\pi}^{\left(\frac{1}{2}\right)}}\right|\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    17. fabs-sqr80.7%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \color{blue}{\left({\pi}^{\left(\frac{1}{2}\right)} \cdot {\pi}^{\left(\frac{1}{2}\right)}\right)}\right) \cdot \left|angle\right|\right)\right)}^{2} \]
    18. sqr-pow81.1%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left|\color{blue}{{angle}^{1}}\right|\right)\right)}^{2} \]
    21. sqr-pow38.9%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left|\color{blue}{{angle}^{\left(\frac{1}{2}\right)} \cdot {angle}^{\left(\frac{1}{2}\right)}}\right|\right)\right)}^{2} \]
    22. fabs-sqr38.9%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \color{blue}{\left({angle}^{\left(\frac{1}{2}\right)} \cdot {angle}^{\left(\frac{1}{2}\right)}\right)}\right)\right)}^{2} \]
    23. sqr-pow81.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.3% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{\left(e^{\mathsf{log1p}\left(0.005555555555555556 \cdot \left(\left(angle \cdot b\right) \cdot \pi\right)\right)} - 1\right)}}^{2} \]
    3. associate-*r*54.4%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(e^{\mathsf{log1p}\left(\pi \cdot \left(0.005555555555555556 \cdot \color{blue}{\left(b \cdot angle\right)}\right)\right)} - 1\right)}^{2} \]
    6. associate-*r*54.4%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\left(\left(0.005555555555555556 \cdot b\right) \cdot angle\right)}\right)} - 1\right)}^{2} \]
  7. Applied egg-rr54.4%

    \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{\left(e^{\mathsf{log1p}\left(\pi \cdot \left(\left(0.005555555555555556 \cdot b\right) \cdot angle\right)\right)} - 1\right)}}^{2} \]
  8. Step-by-step derivation
    1. expm1-def59.2%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(\left(0.005555555555555556 \cdot b\right) \cdot angle\right)\right)\right)\right)}}^{2} \]
    2. expm1-log1p77.3%

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

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

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

    \[\leadsto {a}^{2} + {\left(\pi \cdot \left(0.005555555555555556 \cdot \left(b \cdot angle\right)\right)\right)}^{2} \]

Reproduce

?
herbie shell --seed 2023275 
(FPCore (a b angle)
  :name "ab-angle->ABCF C"
  :precision binary64
  (+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))