ab-angle->ABCF C

Percentage Accurate: 79.5% → 79.5%
Time: 28.3s
Alternatives: 11
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 79.5% accurate, 1.0× speedup?

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

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

Alternative 1: 79.5% accurate, 0.6× speedup?

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

\\
{\left(a \cdot \cos \left(\frac{\frac{\pi}{{\left(\sqrt[3]{\frac{-180}{angle}}\right)}^{2}}}{\sqrt[3]{-180}} \cdot \sqrt[3]{angle}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 40.5% accurate, 0.8× speedup?

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

\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2} + {\left(a \cdot \cos \left(\sqrt{angle} \cdot \frac{\pi}{\frac{180}{\sqrt{angle}}}\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 79.5% accurate, 1.0× speedup?

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

\\
{\left(a \cdot \cos \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 79.4% accurate, 1.0× speedup?

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

\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2} + {\left(a \cdot \cos \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 79.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\pi}{\frac{-180}{angle}}\\
{\left(b \cdot \sin t_0\right)}^{2} + {\left(a \cdot \cos t_0\right)}^{2}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 79.5% accurate, 1.5× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 79.6% 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 79.6% accurate, 1.5× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(\frac{angle}{\frac{-180}{\pi}}\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 79.5% accurate, 1.5× speedup?

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

\\
{a}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 66.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-111}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot 0\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{a}^{2} + {\left(\pi \cdot \left(angle \cdot b\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 56.5% accurate, 3.0× speedup?

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

\\
{a}^{2} + {\left(b \cdot 0\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

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