Computes the difference between the given headings, that is, the number of degrees in the smallest angle by which heading2 could be rotated to produce heading1. A positive answer means a clockwise rotation, a negative answer counterclockwise. The result is always in the range -180 to 180, but is never exactly -180.
Note that simply subtracting the two headings using the - (minus) operator wouldn't work. Just subtracting corresponds to always rotating clockwise from heading2 to heading1; but sometimes the counterclockwise rotation is shorter. For example, the difference between 5 degrees and 355 degrees is 10 degrees, not -350 degrees.
show subtract-headings 80 60 => 20 show subtract-headings 60 80 => -20 show subtract-headings 5 355 => 10 show subtract-headings 355 5 => -10 show subtract-headings 180 0 => 180 show subtract-headings 0 180 => 180
Take me to the full NetLogo Dictionary