Torque does this bit of math because it is a quick way of finding out whether the enemy is facing the same way as him (i.e. the difference between the two headings is zero). Also, if the difference is odd then it means that Torque is facing along a different axis to the enemy. This can be useful if Torque is trying to avoid a missile atack because all he has to do is move forward or backward one space and he won't be on the same axis as the enemy any more.