C庫函數double acos(double x) 返回x的余弦弧弧度。
聲明
以下是acos()函數的聲明。
double acos(double x)
參數
-
x -- 這是一個浮點值在區間 [-1,+1].
返回值
這個函數返回主要x的反余弦,在區間[0,PI]弧度。
例子
下麵的例子演示了如何使用acos()函數。
#include <stdio.h> #include <math.h> #define PI 3.14159265 int main () { double x, ret, val; x = 0.9; val = 180.0 / PI; ret = acos(x) * val; printf("The arc cosine of %lf is %lf degrees", x, ret); return(0); }
讓我們編譯和運行上面的程式,這將產生以下結果:
The arc cosine of 0.900000 is 25.855040 degrees
上一篇:
<math.h> - C語言標準庫
下一篇:
asin() - C函數