title: Shortest distance between two degree marks on a circle?
body: <p>I'm looking for a formula to find the shortest distance in degrees between two degree marks on a circle:  for instance, 30 degrees and 170 degrees (140 degrees).</p>
  
  <p>The two degree marks can be virtually any real number, and isn't necessarily between 0 and 360 (can be negative, or much greater than 360, for instance -528.2 and 740 (which is 171.8 degrees)).  However, the distance should always be &lt;= 180 degrees and >= 0 degrees.</p>
  
  <p>It sounds simple enough.  But, I've been trying to find a good solution for this and I've tried a lot of different code but nothing I've found so far works in all the cases I've tried.  I'm working in c++.  Does anyone have any ideas?</p>