ab-angle->ABCF A

Percentage Accurate: 79.4% → 79.4%
Time: 27.5s
Alternatives: 16
Speedup: 1.0×

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 16 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.4% 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.4% accurate, 0.7× speedup?

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

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

Alternative 2: 79.4% accurate, 0.7× speedup?

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

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

Alternative 3: 79.4% accurate, 0.7× speedup?

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

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

Alternative 4: 79.4% accurate, 0.7× speedup?

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

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

Alternative 5: 79.5% accurate, 0.8× speedup?

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

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

Alternative 6: 79.4% accurate, 0.9× speedup?

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

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

Alternative 7: 79.5% accurate, 1.0× speedup?

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

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

Alternative 8: 79.4% accurate, 1.0× speedup?

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

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

Alternative 9: 79.3% accurate, 1.5× speedup?

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

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

Alternative 10: 79.4% accurate, 1.5× speedup?

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

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

Alternative 11: 74.3% accurate, 1.9× speedup?

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

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

Alternative 12: 74.3% accurate, 2.0× speedup?

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

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

Alternative 13: 74.3% accurate, 2.0× speedup?

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

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

Alternative 14: 74.3% accurate, 2.0× speedup?

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

\\
{\left(\mathsf{hypot}\left(b, 0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle_m\right)\right)\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 15: 74.3% accurate, 2.0× speedup?

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

\\
{\left(\mathsf{hypot}\left(b, 0.005555555555555556 \cdot \left(a \cdot \left(angle_m \cdot \pi\right)\right)\right)\right)}^{2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 16: 56.4% accurate, 6.0× speedup?

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

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

Reproduce

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