




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Math库实用汇总在FP中,Math库为我们提供了丰富的数学函数。以下介绍在OI中可能会用到的Math库中一些函数、过程。使用方法:在程序头用Uses语句加载Math库例子:Program Ex_Math;Uses Math;BeginWriteln(hypot(3,4);End.函数介绍:l hypot原型:function hypot(x:float;y:float):float功能:返回直角三角形中较长边的长度,也就是sqrt(sqr(x)+sqr(y)l ceil原型:function ceil(x:float):Integer功能:返回比参数大的最小整数引发错误:在x超出Integer的范围时会引发溢出错误l floor原型:function floor(x:float):Integer功能:返回参数小的最大整数引发错误:在x超出Integer的范围时会引发溢出错误l power原型:function power(base:float;exponent:float):float功能:返回base的exponent次方引发错误:在base为负数且exponent为小数时l intpower原型:function intpower(base:float;const exponent:Integer):float功能:返回base的exponent次方l ldexp原型:function ldexp(x:float;const p:Integer):float功能:返回2的p次方乘以xl log10原型:function log10(x:float):float功能:返回x的常用对数l log2原型:function log2(x:float):float功能:返回x以2为底的对数l logn原型:function logn(n:float;x:float):float功能:返回x以n为底的对数l Max原型:function Max(a:Integer;b:Integer):Integerfunction Max(a:Int64;b:Int64):Int64function Max(a:Extended;b:Extended):Extended功能:返回a与b中较大的一个l Min原型:function Min(a:Integer;b:Integer):Integerfunction Min(a:Int64;b:Int64):Int64function Min(a:Extended;b:Extended):Extended功能:返回a与b中较小的一个l arcsin原型:function arcsin(x:float):float功能:返回x的反正弦值,返回的是弧度指单位l arccon原型:function arccon(x:float):float功能:返回x的反余弦值,返回的是弧度指单位l tan原型:function tan(x:float):float功能:返回x的正切值,x以弧度为单位l cotan原型:function cotan(x:float):float功能:返回x的余切值,x以弧度为单位l arcsinh原型:function arcsinh(x:float):float功能:返回双曲线的反正弦l arccosh原型:function arccosh(x:float):float功能:返回双曲线的反余弦l arctanh原型:function arctanh(x:float):float功能:返回双曲线的反正切l sinh原型:function sinh(x:float):float功能:返回双曲线的正弦l cosh原型:function sinh(x:float):float功能:返回双曲线的正弦l tanh原型:function sinh(x:float):float功能:返回双曲线的正切l cycletorad原型:function cycletorad(cycle:float):float功能:返回圆的份数转换成弧度之后的值l degtorad原型:function degtorad(deg:float):float功能:返回角度转换成弧度之后的值l radtocycle原型:function radtocycle(rad:float):float功能:返回弧度转换成圆的份数之后的值l radtodeg原型:function radtodeg(rad:float):float功能:返回弧度转换成角度之后的值l MaxValue原型:function maxvalue(const data:Array of float):floatfunction maxvalue(const data:Array of Integer):Integerfunction maxvalue(const data:PFloat;const N:Integer):floatfunction maxvalue(const data:PInteger;const N:Integer):Integer功能:返回数组中的最大值l MinValue原型:function minvalue(const data:Array of float):floatfunction minvalue(const data:Array of Integer):Integerfunction minvalue(const data:PFloat;const N:Integer):floatfunction MinValue(const Data:PInteger;const N:Integer):Integer功能:返回数组中的最小值l sum原型:function sum(const data:Array of float):floatfunction sum(const data:PFloat;const N:LongInt):float功能:求数组中所有数之和l sumsandsquares原型:procedure sumsandsquares(const data:Array of float;var sum:float;var sumofsquares:float)procedure sumsandsquares(const data:PFloat;const N:Integer;var sum:float;var sumofsquares:float)功能:将数组中的数求和方如num中,求平方和放入sumofsquares中例子:(注:以下全都在已经uses math的前提下进行的。)begin Writeln(hypot(6,8); /输出10。102=62+82end.begin writeln(ceil(3.4);/4 writeln(ceil(3.7);/4 writeln(ceil(-3.4);/-3 writeln(ceil(-3.7);/-3 writeln(floor(3.4);/3 writeln(floor(3.7);/3 writeln(floor(-3.4);/-4 writeln(floor(-3.7);/-4end.begin writeln(power(1.1,1.1):2:3); writeln(power(-1.1,3):2:3); writeln(power(1.1,-1.1):2:3); writeln(intpower(1.1,2):2:3); writeln(intpower(4.1,-2):2:3); writeln(intpower(-1.1,2):2:3); writeln(ldexp(2,4):8:4); / 32.0000 writeln(ldexp(0.5,3):8:4);/ 4.0000 writeln(ldexp(-3,3):8:4); / -24.000 Writeln(Log10(10):8:4); Writeln(Log10(1):8:4); Writeln(Log10(0.1):8:4); Writeln(Log2(4):8:4); Writeln(Log2(0.5):8:4); Writeln(Logn(3,4):8:4); Writeln(Logn(exp(1),exp(1):8:4); writeln(max(1,2); writeln(min(1,2);end.begin writeln(arccos(0.5)/pi); writeln(arcsin(0.5)/pi); writeln(arctan(0.5)/pi); /这个不在math库里,在system库里就有 writeln(cos(pi/6); /这个不在math库里,在system库里就有 writeln(sin(pi/6); /这个不在math库里,在system库里就有 writeln(tan(pi/6); writeln(cotan(pi/6);end.begin /返回的是双曲线的 | 定义域 writeln(arcosh(2);/反余弦 | R writeln(arsinh(2);/反正弦 | R writeln(artanh(0.1);/反正切 | -1,1 writeln(cosh(2);/余弦 | R writeln(sinh(2);/正弦 | R writeln(tanh(2);/正切 | Rend.begin /角度、弧度、圆的相互转换,圆是指这么大的角占多少个圆 writeln(cycletorad(1/6)/pi);/圆到弧度 writeln(degtorad(90)/pi);/角度到弧度 writeln(radtocycle(pi/2);/弧度到圆 writeln(radtodeg(pi/3);/弧度到角度end.Var I:Integer; a:array1.10 of float;/一定要是longint或float,就是32为变量begin Randomize ; for I:=low(a) to high (a) do begin ai:=ran
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中国船舶动力系统行业市场发展监测及投资方向研究报告
- 激光癌症诊断仪项目投资可行性研究分析报告(2024-2030版)
- 2023-2029年中国粗粮饼干行业发展监测及投资前景展望报告
- 2025年 锅炉水处理作业G3证考试练习题附答案
- 2025年中国无花果行业市场调研分析及投资战略咨询报告
- 2025年 扶风县职业教育中心招聘考试笔试试题附答案
- 2023-2028年中国制造执行系统行业发展前景预测及投资战略咨询报告
- 2025年中国导爪行业市场发展前景及发展趋势与投资战略研究报告
- 红薯系列产品加工项目可行性研究报告
- 中国高端礼品酒行业市场全景分析及发展趋势预测报告
- 橡胶生产企业设备设施及作业活动风险分级管控清单
- 连带责任担保借条(四篇)
- 2023年计算机图形学试题级考试A卷
- GB/T 42104-2022游乐园安全安全管理体系
- 八年级下册人教版英语单项选择(50题)练习题含答案含答案
- 河北省大众滑雪等级标准(试行)
- GB/T 3863-2008工业氧
- GB/T 31125-2014胶粘带初粘性试验方法环形法
- 班主任班级管理(课堂)课件
- 学院辅导答疑情况记录表
- 31个级地区国家重点监控企业自行监测信息公开平台及污染源监督性监测信息公开网址
评论
0/150
提交评论