Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a rectangle that is facing up. (0 degrees)

I'm getting a number bettween -1000 to 1000 or even more, and this number is the angle that im rotating the rectangle.

How can i know the degrees it facing now?

share|improve this question
Rotating by $360^\circ$ is equivalent to not rotating at all, so just keep adding or subtracting multiples of it until you get something in $[0,360]$. (More specifically, $x\to x-360\lfloor x/360\rfloor$, where $\lfloor\cdot\rfloor$ is the floor function.) Also... he? –  anon Aug 28 '11 at 9:05
Cool it works :) but why didn't you put it as answer ? lol –  Danpe Aug 28 '11 at 9:14
Also, if your programming language (I assume you're doing this in a computer program) has an fmod function or something equivalent, $x \mapsto \operatorname{fmod}(x, 360)$ is probably easier than $x \mapsto x - 360 \cdot \lfloor x/360 \rfloor$. –  Ilmari Karonen Aug 28 '11 at 12:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.