Direction in cyclic spaces

Related to the edition of rotation via 2d gradients, i stumble upon a nice little logical issue: how to pick the shortest path form current value to target one when space is cyclic and not linear. Indeed, rotations are cyclic, PI and PI*3 are not the same angles, ok, but you end up at the