C90 | double atan2(double y, double x); |
C99 | double atan2 (double y , double x);
float atan2f (float y , float x); long double atan2l (long double y, long double x); |
C++98 | double atan2 (double y , double x);
float atan2 (float y , float x); long double atan2 (long double y, long double x); |
C++11 | double atan2 (double y , double x);
float atan2 (float y , float x); long double atan2 (long double y, long double x); double atan2 (Type1 y , Type2 x); // additional overloads |
C99 | 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。 |
C++98 | 这个函数在<valarray> 中重载(参见valarray atan2)。 |
C++11 | 这个头文件(<cmath>) 为其他算术类型(Type1和Type2)提供了额外的重载:
这些重载在计算前有效地将其实参转换为double,
如果有一个实参是long double类型,两个实参都被转换为long double类型。
这个函数在<valarray> 中也重载(参见valarray atan)。 |
C90(C++98) | 如果发生域错误,则将全局变量errno设置为EDOM。 |
C99(C++11) | 如果出现域错误:
-并且math_errhandling设置了MATH_ERRNO: 全局变量errno设置为EDOM。 -并且math_errhandling设置了MATH_ERREXCEPT: 触发FE_INVALID。 |
/* atan2 example */ #include <stdio.h> /* printf */ #include <math.h> /* atan2 */ #define PI 3.14159265 int main () { double x, y, result; x = -10.0; y = 10.0; result = atan2 (y,x) * 180 / PI; printf ("The arc tangent for (x=%f, y=%f) is %f degrees\n", x, y, result ); return 0; } |
cos | 余弦 (function ) |
sin | 正弦 (function ) |
tan | 正切 (function ) |
atan | 反正切 (function ) |