Converting from Radians to Degrees
You want to calculate radians=tan(y/x) first. Then you can convert it to degrees: See the reference here for atan: On a side note, you also have to take into account what quadrant you are in to get the correct answer (since -y/x is the same number as y/-x)