You should also note that you're never going to get an angle outside the of 0-90 the way you're doing it. You'd have to use the signs of the opposite and adjacent sides specifically to determine which quadrant you're in.