C语言里sin函数和cos函数是C标准数学函数库中的函数,调用需要引入math.h头文件。
一、sin() 函数描述:
C 库函数 double sin(double x) 返回弧度角 x 的正弦。sin() 函数的声明:double sin(double x)。
参数:x -- 浮点值,代表了一个以弧度表示的角度。
返回值:该函数返回 x 的正弦。
二、cos() 函数描述:
cos() 函数的功能是求某个角的余弦值。cos() 函数的声明:double cos(double x)。
参数:x -- 浮点值,代表了一个以弧度表示的角度。
返回值:该函数返回 x 的余弦。
扩展资料:
相关的三角函数:
double asin (double)结果介于[-PI/2,PI/2]
double acos (double)结果介于[0,PI]
double atan (double)反正切(主值),结果介于[-PI/2,PI/2]
double atan2 (double,double)反正切(整圆值),结果介于[-PI,PI]
参考资料来源:百度百科-math.h
cos()是库函数,在头文件math.h中,原型是double cos(double x),其中x要用弧度表示。如求30°的余弦值可用下列代码实现://#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
#include "math.h"
int main(void){
printf("cos30°= %.10f\n",cos(30*3.1415926535897932/180))
return 0
}