C++ cmath atan() 函数
示例
返回不同数字的反正切值
cout << atan(0.5);
cout << atan(-0.5);
cout << atan(5);
cout << atan(-5);
cout << atan(100);
cout << atan(-100);
自己动手试一试 »
定义和用法
atan()
函数以弧度为单位返回数字的反正切值。
atan()
函数定义在 <cmath>
头文件中。
提示: atan() 函数仅返回 -PI/2 和 PI/2 之间的角度。 atan2() 函数可以返回任何角度。
语法
以下之一
atan(double number);
atan(float number);
参数值
参数 | 描述 |
---|---|
数字 | 必需。指定一个数字。如果数字是整数类型,它将被视为 double 。 |
技术详情
返回 | 一个 float 值(如果参数是 float)或 double 值(其他所有情况),表示数字的反正切值。 |
---|