# <!-- var kmNextPage = "c251_atof.htm"; var kmPrevPage = "c251_atan.htm"; var kmNextPageTitle = "atof"; var kmPrevPageTitle = "atan"; var kmBreadCrumbs = "<a href=\"default.htm\">Home</a> &raquo; <a href=\"c251_library.htm\">Library Reference</a> &raquo; <a href=\"c251_libref.htm\">Reference</a> &raquo; atan2"; kmSetupPaging (); kmNavButtons(); //--> atan2

 Summary ```#include double atan2 ( double y, /* denominator for arc tangent */ double x); /* numerator for arc tangent */ ``` Description The atan2 function calculates the arc tangent of the floating-point ratio y / x. This function uses the signs of both x and y to determine the quadrant of the return value. The floating-point value returned by atan2 is a number in the range -π to π. Return Value The atan2 function returns the arc tangent of y / x. For y = 0 and x = 0, atan2 → NaN. For y = 0 and x > 0, atan2 → 0. For y = 0 and x < 0, atan2 → 2π. See Also Example ```#include #include /* for printf */ void tst_atan2 (void) { float x; float y; float z; x = -1.0; for (y = -10.0; y < 10.0; y += 0.1) { z = atan2 (y,x); printf ("ATAN2(%f/%f) = %f\n", y, x, z); } /* z approaches -pi as y goes from -10 to 0 */ /* z approaches +pi as y goes from +10 to 0 */ } ```

##### Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.