Jonas is developing the JUxtaPhone and is tasked with animating the compass needle. The API is simple: the compass needle is currently in some direction (between 0 and 359 degrees, with north being 0 and east being 90), and it is animated by giving it the number of degrees to spin. If the needle points north and you give the compass an input of 90, it spins clockwise (positive numbers mean the clockwise direction) and stops at east, whereas an input of -45 spins it counter-clockwise and stops at north west.
The compass reports the direction the phone currently points, and Jonas has to animate the needle along the shortest path from the current needle direction to the correct direction. Many ifs, moduli, and even an arctangent later, he is still not convinced his minimumDistance function is correct, so he calls you on the phone.