# Adding negative angle in a circle

I am unsure how to even ask this.

I have a circle and I am at point 0. I add -90, which would bring me at 270. What would this look like as an equation? where -90 could be any negative number from -1 to - 359 and the result would be the positive point.

-

If you have some angle $X$ (assuming degrees), and you have to find its measure that is in interval $[0, 360)$, then the following might help:

If $X$ is any angle, and if we ignore multiple turns, then there is a corresponding angle that is in $[0,360)$. When we're talking about angles, then following holds $X = X + 360k, k\in \mathbb{Z}$, if we ignore the turns. In your case we have $-90 + 360k, k = 0$, choose $k=1$ and get $-90+360=270$.

More generally: Let $X$ be some angle in degrees. Then if we ignore multiple turns, its corresponding angle $X'$ in $[0, 360)$ is determined by following formula: $$X' = X - \lfloor X/360 \rfloor \cdot 360$$

-
I am having trouble understanding this so wont mark the other answers as correct until I do. I will look up the symbols tonight. Thank you. –  My Name is Nobody Mar 29 '11 at 20:18
@Oh Danny Boy: You're welcome, and if you don't understand the notation feel free to ask. –  user5501 Mar 29 '11 at 20:22

You could say $0-90\equiv 270 (mod 360)$

-
float rotate = -90; float result = 0 - rotate % 360; Hmmm, that gives me 90. I don't think that is correct. Where does the mod 360 go? –  My Name is Nobody Mar 29 '11 at 19:35
use brackets $(0-rotate)$ % 360 –  picakhu Mar 29 '11 at 19:57
Computers don't do $\bmod$ right, for negative numbers. You can define real_mod(x, n) = ((x%n)+n)%n, and then real_mod(-90, 360) = 270. Think about why computer mod isn't correct for negative numbers (you should look up modular rings), and why real_mod as above is correct. Picakhu, that's not right. The first way, he calculates -90%360=-90 and subtracts that from 0, your way first negates -90 to get 90, then takes 90%360=90. –  leif Mar 29 '11 at 19:59
I do not believe there is a "real mod" in javascript. –  My Name is Nobody Mar 29 '11 at 20:15
@Oh,leif wants you to MAKE that function. I am definitely shocked that javascript does not handle mod's well. Maybe in that case, try what was suggested by leif, that ought to work. The reason it fails is because -90 is perfectly fine as a mod 360. So, perhaps another solution is if value=mod(0-x)<0, then value=360+x. –  picakhu Mar 29 '11 at 21:07