?

Average Error: 20.4 → 20.5
Time: 1.6min
Precision: binary64
Cost: 97476

?

\[{\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} \]
\[\begin{array}{l} t_0 := {\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{2}\\ {\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \begin{array}{l} \mathbf{if}\;t_0 \ne 0:\\ \;\;\;\;{\left({t_0}^{-3}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{angle}\right)}^{2}\\ \end{array}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+
  (pow (* a (cos (* PI (/ angle 180.0)))) 2.0)
  (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (pow (cbrt (cbrt angle)) 2.0)))
   (+
    (pow
     (*
      a
      (cos
       (*
        (* PI (cbrt angle))
        (*
         0.005555555555555556
         (if (!= t_0 0.0) (pow (pow t_0 -3.0) -1.0) (pow (cbrt angle) 2.0))))))
     2.0)
    (pow (* b (sin (* PI (/ angle 180.0)))) 2.0))))
double code(double a, double b, double angle) {
	return pow((a * cos((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
double code(double a, double b, double angle) {
	double t_0 = pow(cbrt(cbrt(angle)), 2.0);
	double tmp;
	if (t_0 != 0.0) {
		tmp = pow(pow(t_0, -3.0), -1.0);
	} else {
		tmp = pow(cbrt(angle), 2.0);
	}
	return pow((a * cos(((((double) M_PI) * cbrt(angle)) * (0.005555555555555556 * tmp)))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
	return Math.pow((a * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.pow(Math.cbrt(Math.cbrt(angle)), 2.0);
	double tmp;
	if (t_0 != 0.0) {
		tmp = Math.pow(Math.pow(t_0, -3.0), -1.0);
	} else {
		tmp = Math.pow(Math.cbrt(angle), 2.0);
	}
	return Math.pow((a * Math.cos(((Math.PI * Math.cbrt(angle)) * (0.005555555555555556 * tmp)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
function code(a, b, angle)
	return Float64((Float64(a * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0))
end
function code(a, b, angle)
	t_0 = cbrt(cbrt(angle)) ^ 2.0
	tmp = 0.0
	if (t_0 != 0.0)
		tmp = (t_0 ^ -3.0) ^ -1.0;
	else
		tmp = cbrt(angle) ^ 2.0;
	end
	return Float64((Float64(a * cos(Float64(Float64(pi * cbrt(angle)) * Float64(0.005555555555555556 * tmp)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0))
end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[Power[N[Power[angle, 1/3], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[(N[(Pi * N[Power[angle, 1/3], $MachinePrecision]), $MachinePrecision] * N[(0.005555555555555556 * If[Unequal[t$95$0, 0.0], N[Power[N[Power[t$95$0, -3.0], $MachinePrecision], -1.0], $MachinePrecision], N[Power[N[Power[angle, 1/3], $MachinePrecision], 2.0], $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
{\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}
\begin{array}{l}
t_0 := {\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{2}\\
{\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \begin{array}{l}
\mathbf{if}\;t_0 \ne 0:\\
\;\;\;\;{\left({t_0}^{-3}\right)}^{-1}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{angle}\right)}^{2}\\


\end{array}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}

Error?

Derivation?

  1. Initial program 20.4

    \[{\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. Applied egg-rr24.1

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \sqrt[3]{{angle}^{2}}\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  3. Applied egg-rr20.5

    \[\leadsto {\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{\left(\sqrt[3]{angle} \cdot \sqrt[3]{angle}\right)}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Simplified20.5

    \[\leadsto {\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{{\left(\sqrt[3]{angle}\right)}^{2}}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    Proof
  5. Applied egg-rr24.1

    \[\leadsto {\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\sqrt[3]{\sqrt[3]{{angle}^{2}}} \ne 0:\\ \;\;\;\;\frac{1}{{\left(\sqrt[3]{\sqrt[3]{{angle}^{2}}}\right)}^{-3}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{angle}^{2}}\\ } \end{array}}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  6. Simplified20.5

    \[\leadsto {\left(a \cdot \cos \left(\left(\pi \cdot \sqrt[3]{angle}\right) \cdot \left(0.005555555555555556 \cdot \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{2} \ne 0:\\ \;\;\;\;{\left({\left({\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{2}\right)}^{-3}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{angle}\right)}^{2}\\ } \end{array}}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    Proof

Alternatives

Alternative 1
Error20.5
Cost52224
\[{\left(a \cdot \cos \left({\left(\sqrt[3]{0.005555555555555556 \cdot \left(\pi \cdot angle\right)}\right)}^{3}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
Alternative 2
Error20.4
Cost39360
\[\begin{array}{l} t_0 := angle \cdot \left(0.005555555555555556 \cdot \pi\right)\\ {\left(a \cdot \cos t_0\right)}^{2} + {\left(b \cdot \sin t_0\right)}^{2} \end{array} \]
Alternative 3
Error20.4
Cost26368
\[{\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2} \]
Alternative 4
Error20.7
Cost20616
\[\begin{array}{l} t_0 := {\left(a \cdot 1\right)}^{2}\\ t_1 := t_0 + \frac{\left(\left(1 - \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right) \cdot b\right) \cdot b}{2}\\ t_2 := angle \cdot \left(b \cdot \pi\right)\\ \mathbf{if}\;angle \leq -1.7 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq 0.0052:\\ \;\;\;\;t_0 + t_2 \cdot \left(0.005555555555555556 \cdot \left(0.005555555555555556 \cdot t_2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error20.6
Cost20616
\[\begin{array}{l} t_0 := \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\\ t_1 := {\left(a \cdot 1\right)}^{2}\\ t_2 := angle \cdot \left(b \cdot \pi\right)\\ \mathbf{if}\;angle \leq -0.004:\\ \;\;\;\;t_1 + \left(b \cdot 0.5 + b \cdot \left(t_0 \cdot -0.5\right)\right) \cdot b\\ \mathbf{elif}\;angle \leq 1660:\\ \;\;\;\;t_1 + t_2 \cdot \left(0.005555555555555556 \cdot \left(0.005555555555555556 \cdot t_2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 + \frac{\left(\left(1 - t_0\right) \cdot b\right) \cdot b}{2}\\ \end{array} \]
Alternative 6
Error20.8
Cost20552
\[\begin{array}{l} t_0 := {\left(a \cdot 1\right)}^{2}\\ t_1 := t_0 + \frac{\left(\left(1 - \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right) \cdot b\right) \cdot b}{2}\\ \mathbf{if}\;angle \leq -1.7 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq 1660:\\ \;\;\;\;t_0 + {\left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(angle \cdot b\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error25.8
Cost20488
\[\begin{array}{l} t_0 := angle \cdot \left(b \cdot \pi\right)\\ t_1 := {\left(a \cdot 1\right)}^{2}\\ \mathbf{if}\;b \leq -12000000000000:\\ \;\;\;\;t_1 + {\left(0.005555555555555556 \cdot t_0\right)}^{2}\\ \mathbf{elif}\;b \leq 10^{-264}:\\ \;\;\;\;t_1 + \left(\left(\left(b \cdot \pi\right) \cdot t_0\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\\ \mathbf{else}:\\ \;\;\;\;t_1 + {\left(\left(angle \cdot b\right) \cdot \pi\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \]
Alternative 8
Error26.1
Cost20360
\[\begin{array}{l} t_0 := {\left(a \cdot 1\right)}^{2}\\ \mathbf{if}\;b \leq -3 \cdot 10^{-165}:\\ \;\;\;\;t_0 + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-265}:\\ \;\;\;\;t_0 + \left({\left(\pi \cdot angle\right)}^{2} \cdot \left(b \cdot b\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\ \mathbf{else}:\\ \;\;\;\;t_0 + {\left(\left(angle \cdot b\right) \cdot \pi\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\ \end{array} \]
Alternative 9
Error26.3
Cost19968
\[{\left(a \cdot 1\right)}^{2} + {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5} \]
Alternative 10
Error26.3
Cost19968
\[{\left(a \cdot 1\right)}^{2} + {\left(\left(angle \cdot b\right) \cdot \pi\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5} \]
Alternative 11
Error26.2
Cost19968
\[{\left(a \cdot 1\right)}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} \]
Alternative 12
Error26.2
Cost19968
\[{\left(a \cdot 1\right)}^{2} + {\left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(angle \cdot b\right)\right)}^{2} \]

Error

Reproduce?

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