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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 20.9

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Applied egg-rr20.9

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

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

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

Alternatives

Alternative 1
Error20.9
Cost39360
\[{\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} \]
Alternative 2
Error20.9
Cost39360
\[{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
Alternative 3
Error20.9
Cost39360
\[{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
Alternative 4
Error21.0
Cost26240
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} + {b}^{2} \]
Alternative 5
Error21.0
Cost26240
\[{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {b}^{2} \]
Alternative 6
Error24.2
Cost20360
\[\begin{array}{l} \mathbf{if}\;a \leq -1.16 \cdot 10^{+145}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+138}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(a \cdot a\right) \cdot {\pi}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)}^{2}\\ \end{array} \]
Alternative 7
Error24.5
Cost20360
\[\begin{array}{l} \mathbf{if}\;a \leq -3.8 \cdot 10^{+144}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{+149}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\left(a \cdot a\right) \cdot {\pi}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(\pi \cdot angle\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)\right)\\ \end{array} \]
Alternative 8
Error24.3
Cost20096
\[{b}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(\left(1 + a \cdot \pi\right) + -1\right)\right)\right)}^{2} \]
Alternative 9
Error26.4
Cost19840
\[{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(a \cdot \pi\right)\right)}^{2} \]
Alternative 10
Error26.3
Cost19840
\[{b}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)}^{2} \]
Alternative 11
Error26.3
Cost19840
\[{b}^{2} + {\left(0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)}^{2} \]
Alternative 12
Error26.3
Cost19840
\[{b}^{2} + {\left(a \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} \]

Error

Reproduce

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