ang(x)

Shifts the angle x into the -180 .. +180 range by adding or subtracting a multiple of 360 degrees. Often useful for calculating angle differences.

Parameters:

x - any angle.

Returns:

Same angle, shifted into the -180 .. +180 range.

Speed:

Fast

Example:

x = ang(0); // x is 0 
x = ang(-350); // x is 10 
x = ang(185); // x is -175  

See also:

sin, cos ► latest version online