Assuming that y is in the north direction and x in the east direction, with the already suggested correction of changing the (-) to a (+), your equations should work just fine. The one time where you might want a (-) is if you are using screen coordinates where y is positive downwards (i.e. towards the south).

If you are doing this calculation a lot, you might want to define a constant for the PI/180 radians/degree. As you undoubtedly know, 90° is PI/2 radians, 180° = PI radians, 270 = 3*PI/2 radians, and 360 = 2*PI radians.

The problem is slightly trickier if you know the direction cosines and want to calculate the bearings because the trig values repeat between 0 and 360.