Home C&C++函数库 c++ 语法 程序源码 Linux C库

atan

函数  <cmath> <ctgmath>

C90 double atan(double x);
C99 double atan (double x);
float atanf (float x);
long double atanl (long double x);
C++98 double atan (double x);
float atan (float x);
long double atan (long double x);
C++11 double atan (double x);
float atan (float x);
long double atan (long double x);
double atan (T x);    // additional overloads for integral types

计算反正切
返回x的反正切的主值,以弧度表示。
在三角函数中,反正切是正切的逆运算。

注意,由于符号不明确,函数不能确定角度落在哪个象限,只能通过它的切线值。 参见atan2以分数参数代替的替代方法。

C99 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。
C++98 这个函数在<valarray> 中重载(参见valarray atan)。
C++11 这个头文件(<cmath>) 为整型提供了额外的重载:这些重载在计算之前将x转换为double (在T是任何整型时定义)。
这个函数在<complex>和<valarray> 中也重载(参见complex atan和valarray atan)。

☲  参数


x
反正切计算的值。

☉  返回值



x的反正切主值,在[-pi /2,+pi /2]弧度范围内。
一弧度(radian)等于180/PI 角度。

☣  示例



/* atan example */
#include <stdio.h>      /* printf */
#include <math.h>       /* atan */

#define PI 3.14159265

int main ()
{
  double param, result;
  param = 1.0;
  result = atan (param) * 180 / PI;
  printf ("The arc tangent of %f is %f degrees\n", param, result );
  return 0;
}

输出:
The arc tangent of 1.000000 is 45.000000 degrees.

🍄  另请参阅



atan2 两个参数的反正切 (function )
tan 正切(function )
sin 正弦(function )
cos 余弦(function )


联系我们 免责声明 关于CandCplus 网站地图