C 语言常用数学函数及其用法 三角函数:(所有参数必须为弧度) 1
acos 函数申明:acos (double x); 用途:用来返回给定的 X 的反余弦函数
asin 函数申明:asin (double x); 用途:用来返回给定的 X 的反正弦函数
atan 函数申明:atan (double x); 用途:用来返回给定的 X 的反正切函数
sin 函数声明:sin (double x); 用途:用来返回给定的 X 的正弦值
cos 函数声明:cos (double x); 用途:用来返回给定的 X 的余弦值
tan 函数声明:tan (double x); 用途:用来返回给定的 X 的正切值
atan2 函数声明:atan2 (double y, double x); 用途:返回给定的 X 及 Y 坐标值的反正切值 其他函数: 8
atof 函数名: atof (const char *s); 功 能: 把字符串转换成浮点数 用 法: double atof(const char *nptr); 程序例: #i nclude #i nclude int main(void) { float arg,*point=&arg; float f; char *str = "12345
67"; f = atof(str); printf("string = %s float = %f\n", str, f); return 0; } 9
ceil 和 floor 函数名: ceil floor 功 能: 向上舍入 向下舍入 用 法: double ceil(double x); double floor(double x); 程序例: #i nclude int main(void) { double number = 123