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() 函数只能返回 -π/2 到 π/2 之间的角度。atan2() 函数可以返回任意角度。
语法
以下选项之一:
atan(double number);
atan(float number);
参数值
| 参数 | 描述 |
|---|---|
| number | 必填。指定一个数字。如果该数字为整数类型,则会被视为 double 类型。 |
技术细节
| 返回值: | 表示一个数的反正切值的 float 值(如果参数是 float 类型)或 double 值(在其他情况下)。 |
|---|

