Here’s a really simple math problem in 2D games development that has a surprisingly complex solution. If I were to give you angles *a* and *b*, how would you calculate 1) **the direction** — that is, clockwise being positive; and anti-clockwise being negative — and 2) **magnitude** of the shorter angle of rotation from *a* to *b*?

When you visualise it, both values seem so obvious; which was why I was so surprised I couldn’t figure it out. On the surface, it seems really simple — if you just take *b – a*, doesn’t it give you the solution?