Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <math.h> double atan2(double x, double y);float atanf(float x); (C11) These functions calculate the arc tangent of x/y. The signs of the two arguments determine the resulting quadrants. | |
Return val. | arc tangent(x/y) | |
a floating-point number of type | ||
0 | if the dividend x is equal to 0. | |
pi/2 | if both arguments are equal to 0. | |
Example | The following program reads in the arguments x and y and prints the computed arc tangent of x/y. #include <math.h> #include <stdio.h> int main(void) { double x, y; printf("Example of ATAN2(x/y)\n"); printf("Enter x and y please:\n"); if (scanf("%lf %lf", &x, &y) == 2) printf("ATAN2 (%g / %g) = %g\n", x, y, atan2(x, y)); return 0; } | |
See also | atan, tan, sin, asin, cos, acos |