atan2()

So, I want to calculate the heading of a moving object and this is what I found:

double heading(double x, double y) {
  double head = atan2(y, x); // Slope Y, Slope X
  return head;
}

So what I wanted to know is what is the output of the function atan2().

Thank you in advance.

Bakr:
So what I wanted to know is what is the output of the function atan2().

So look up the expected parameters and the return value in the AVR LIBC manual of atan2()

short answer, the angle in radians

Think of an xy plane, if you have a vector that goes from 0 to 1,1 then the magnitude will be the sqrt(2) and the angle will be 45 degrees. atan2 takes the x and the y and returns the 45 degrees. It needs x and y so it will be correct for the whole circle. if you pass it just the ratio of x and y, it cannot determine the quadrant. In this case, if it did not take x and y into account it could be 1,1 or -1,-1.

But atan2() returns radians, not degrees.