Linux常用数学函数篇.pdf

  1. 1、本文档共9页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Linux常用数学函数篇

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 = %f\n, angle); } 执行 angle = 1.047198 asin(取反正弦函数值) 页码,1/9Untitled Document 2004-1-9file://D:\linux_c\function\06.html 相关函数 acos , atan , atan2 , cos , sin , tan 表头文件 #include math.h 定义函数 double asin (double x) 函数说明 asin()用来计算参数x的反正弦值,然后将结果返回。参数x范围为 -1至1之间,超过此范围则会失败。 返回值 返回-PI/2之PI/2之间的计算结果。 错误代码 EDOM参数x超出范围 附加说明 使用GCC编译时请加入-lm 范例 #includemath.h main() { double angle; angle = asin (0.5); printf(angle = %f\n,angle); } 执行 angle = 0.523599 atan(取反正切函数值) 相关函数 acos,asin,atan2,cos,sin,tan 表头文件 #includemath.h 定义函数 double atan(double x); 函数说明 atan()用来计算参数x的反正切值,然后将结果返回。 返回值 返回-PI/2至PI/2之间的计算结果。 附加说明 使用GCC编译时请加入-lm 范例 #includemath.h main() { double angle; angle =atan(1); printf(angle = %f\n,angle); } 执行 angle = 1.570796 atan2(取得反正切函数值) 相关函数 acos,asin,atan,cos,sin,tan 表头文件 #includemath.h 页码,2/9Untitled Document 2004-1-9file://D:\linux_c\function\06.html 定义函数 double atan2(double y,double x); 函数说明 atan2()用来计算参数y/x的反正切值,然后将结果返回。 返回值 返回-PI/2 至PI/2 之间的计算结果。 附加说明 使用GCC编译时请加入-lm。 范例 #includemath.h main() { double angle; angle = atan2(1,2); printf(angle = %f\n, angle); } 执行 angle = 0.463648 ceil(取不小于参数的最小整型数) 相关函数 fabs 表头文件 #include math.h 定义函数 double ceil (double x); 函数说明 ceil()会返回不小于参数x的最小整数值,结果以double形态返回。 返回值 返回不小于参数x的最小整数值。 附加说明 使用GCC编译时请加入-lm。 范例 #includemath.h main() { double value[ ]={4.8,1.12,-2.2,0}; int i;

文档评论(0)

l215322 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档