#include <math.h>
double atan2( double y, double x );
计算y/x的反正切值,按照参数的符号计算所在的象限。
#include <stdio.h> #include <math.h> int main(void) { double result; double x = 90.0, y = 45.0; result = atan2(y, x); printf("The arc tangent ratio of %lf is %lf\n", (y / x), result); return 0; }
输出结果:
The arc tangent ratio of 0.500000 is 0.463648