Im doing some exercises from a book, and in one of them i have to rewrite the function atan2f. First, i wanted to explore a bit about this function, and while doing this i noticed that the results given by this function differed from the ones given in the book. For example, the book says that atan2f(4,2) = 63.46(degrees) and when i do this:

the result is 1.1 pi, that is 198 degrees. When i check this on a sheet of paper i realise that the result given by the book is the correct one. Whats wrong with this?Code:#include <iostream> #include <cmath> using namespace std; int main() { cout << atan2f(4,2) << endl; system("PAUSE"); }

Maybe i misunderstood the excercise. This is the exercise:

Thank you,Code:Using atanf, write a function with the following prototype: float MyArcTangent(float y, float x); This function should examine the signs of coordinates of the point (x, y) and return the correct angle based on what quadrant the point lies in. Test your function with the following points: (2,4), (-1,5), (-6,-4), (4, -6). You sould get the following results: MyArcTangent (4, 2) = 63.4671 MyArcTangent (5, -1) = 101.27 MyArcTangent (-4, -6) = 213.707 MyArcTangent (-6, 4) = -56.3385 Press any key to continue Now that you have written the function yourself, you should know that the C++ standard math library already includes a function that does what your function does. Its prototype is: float atan2f(float y, float x);

Cherry65.