C语言常用数学函数..docVIP

  • 76
  • 0
  • 约6.42千字
  • 约 13页
  • 2017-01-11 发布于重庆
  • 举报
C语言常用数学函数.

常用数学函数 abs(计算整型数的绝对值) 相关函数 labs, fabs 表头文件 #includestdlib.h 定义函数 int abs (int j) 函数说明 abs()用来计算参数j的绝对值,然后将结果返回。 返回值 返回参数j的绝对值结果。 范例 #ingclude stdlib.h main(){ int ansert; answer = abs(-12); printf(|-12| = %d\n, answer); } 执行 |-12| = 12   acos(取反余弦函数数值) 相关函数 asin , atan , atan2 , cos , sin , tan 表头文件 #include math.h 定义函数 double acos (double x); 函数说明 acos()用来计算参数x的反余弦值,然后将结果返回。参数x范围为-1至1之间,超过此范围则会失败。 返回值 返回0至PI之间的计算结果,单位为弧度,在函数库中角度均以弧度来表示。 错误代码 EDOM参数x超出范围。 附加说明 使用GCC编译时请加入-lm。 范例 #include math.h main (){ double angle; angle = acos(0.5); printf(angle = %

文档评论(0)

1亿VIP精品文档

相关文档