C++ cmath acos() 函数
示例
返回不同数字的反余弦值:
cout << acos(0.64);
cout << acos(-0.4);
cout << acos(0);
cout << acos(1);
cout << acos(-1);
cout << acos(2);
亲自试一试 »
定义和用法
acos() 函数返回一个数的弧度反余弦值。
acos() 函数定义在 <cmath> 头文件中。
语法
以下选项之一:
acos(double number);
acos(float number);
参数值
| 参数 | 描述 |
|---|---|
| number | 必填。要计算反余弦值的数字,范围在 -1 到 1 之间。如果值超出 -1 到 1 的范围,则返回 NaN(非数字)。 如果该数字是整数类型,则会被视为 double 类型。 |
技术细节
| 返回值: | 表示弧度制数值的反余弦值的 float 值(如果参数是 float 类型)或 double 值(在其他情况下)。 |
|---|

