I would recomend always using the -180<>180 range returned from ang instruction so you can take advantaje of the symmetry of the sign.

Code:
if ( abs(angle) < 45 )
   // front
else if ( abs(angle) > 135 )
   // back
else if ( angle > 0 )
   // left
else
   // right



Anyway cycle(angle,0,360); does the job.
Salud!

Last edited by txesmi; 08/10/15 12:15.