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 值(其他所有情況),表示數字的反正切值。 |
---|