acos() – C函数

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.14159265int 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

以上是acos() – C函数的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>