atan2 math.h In C, the atan2(y, x) function from math.h calculates the arc tangent of y/x, considering the signs of both x and y to determine the correct quadrant. In Java, you can use Math.atan2(y, x), which works the same way. It returns the angle in radians between the positive x-axis and the point (x, y).