I have a float value, that represents an angle. I need the quickest way to determine if the angle is between 0 and PI, or PI and 2 PI. If the float value is outside of the range 0 to 2 PI, it should still work. I have the following, but I fear it is slow compared to other solutions:
// float fltValue;
// bool blnResult;
while (fltValue < 0)
{ fltValue += 2 * PI; }
while (fltValue >= 2 * PI)
{ fltValue -= 2 * PI; }
if (fltValue < PI)
{ blnResult = true; }
else
{ blnResult = false; }
Is there a faster way of doing this? Preferably no loops.
Thank you.