C语言 <math.h> acos 函数 描述 C库函数double acos(double x) 返回弧度x的反余弦值。 声明 以下是acos函数的声明。 double acos(double x) 复制 参数 x - 这是区间[-1,+ 1]中的浮点值。 返回值 此函数以间隔[0,pi弧度]返回x的主反余弦。 示例 以下示例显示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头文件