Average Error: 20.6 → 20.6
Time: 19.1s
Precision: binary64
Cost: 52160
\[{\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} \]
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} \]
(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
 (+
  (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
  (pow (* b (expm1 (log1p (cos (* angle (* PI 0.005555555555555556)))))) 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) {
	return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * expm1(log1p(cos((angle * (((double) M_PI) * 0.005555555555555556)))))), 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) {
	return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.expm1(Math.log1p(Math.cos((angle * (Math.PI * 0.005555555555555556)))))), 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):
	return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.expm1(math.log1p(math.cos((angle * (math.pi * 0.005555555555555556)))))), 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)
	return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * expm1(log1p(cos(Float64(angle * Float64(pi * 0.005555555555555556)))))) ^ 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_] := 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[(Exp[N[Log[1 + N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $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}
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 20.6

    \[{\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.6

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)}\right)}^{2} \]
  3. Final simplification20.6

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

Alternatives

Alternative 1
Error20.6
Cost39360
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
Alternative 2
Error20.7
Cost39360
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} \]
Alternative 3
Error20.6
Cost39360
\[{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
Alternative 4
Error20.6
Cost39360
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} \]
Alternative 5
Error20.6
Cost26240
\[{b}^{2} + {\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
Alternative 6
Error20.6
Cost26240
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
Alternative 7
Error22.3
Cost20424
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.8 \cdot 10^{+47}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;angle \leq 1.02 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(\left(a \cdot angle\right) \cdot \left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(a \cdot angle\right)\right), \pi \cdot 0.005555555555555556, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \]
Alternative 8
Error22.3
Cost20104
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.8 \cdot 10^{+47}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;angle \leq 1.02 \cdot 10^{+35}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \]
Alternative 9
Error22.3
Cost20040
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.8 \cdot 10^{+47}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;angle \leq 1.02 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(b, b, {\left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(a \cdot angle\right)\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \]
Alternative 10
Error22.3
Cost19976
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.8 \cdot 10^{+47}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;angle \leq 1.02 \cdot 10^{+35}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(a \cdot angle\right), b\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \]
Alternative 11
Error32.1
Cost192
\[b \cdot b \]

Error

Reproduce

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