I have three doubles:
double[] accel = new double[3]
{
_Razor.Accel_X,
_Razor.Accel_Y,
_Razor.Accel_Z,
};
What's the most efficient way to find the largest of these in NETMF?
I have three doubles:
double[] accel = new double[3]
{
_Razor.Accel_X,
_Razor.Accel_Y,
_Razor.Accel_Z,
};
What's the most efficient way to find the largest of these in NETMF?
double result = accel[0];
if (accel[1] > result) result = accel[1];
if (accel[2] > result) result = accel[2];
return result;
Probably just this, right?
double max = _Razor.Accel_X;
if (_Razor.Accel_Y > max)
max = _Razor.Accel_Y;
if (_Razor.Accel_Z > max)
max = _Razor.Accel_Z;
Or did you want something prettier?
i believe it is the usual way.
double max = max((max(accel[0],accel[1]),accel[2])