I want to record speed of angle movement in a 3D game.
So we have the X axis, where we move from 0-360 with no border, when we are on 359 and move further we hit 0 again. 

The game stores the 0-360 in -180-180 instead of 0-360
To calculate the speed I have to record two stages and compare there difference with the time it took, to get the movement speed.

But how do I get the difference.
the difference from 80-120 is = 40 we can just calculate by minusing them.
but the difference from -175 to 175 is = 10, but how do I calculate that? Cause minus them will give -180, but the difference is actually 10.