




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Math库实用汇总在FP中,Math库为我们提供了丰富的数学函数。以下介绍在OI中可能会用到的Math库中一些函数、过程。使用方法:在程序头用Uses语句加载Math库例子:Program Ex_Math;Uses Math;BeginWriteln(hypot(3,4);End.函数介绍:hypot原型:function hypot(x:float;y:float):float功能:返回直角三角形中较长边的长度,也就是sqrt(sqr(x)+sqr(y)ceil原型:function ceil(x:float):Integer功能:返回比参数大的最小整数引发错误:在x超出Integer的范围
2、时会引发溢出错误floor原型:function floor(x:float):Integer功能:返回参数小的最大整数引发错误:在x超出Integer的范围时会引发溢出错误power原型:function power(base:float;exponent:float):float功能:返回base的exponent次方引发错误:在base为负数且exponent为小数时intpower原型:function intpower(base:float;const exponent:Integer):float功能:返回base的exponent次方ldexp原型:function ldexp(
3、x:float;const p:Integer):float功能:返回2的p次方乘以xlog10原型:function log10(x:float):float功能:返回x的常用对数log2原型:function log2(x:float):float功能:返回x以2为底的对数logn原型:function logn(n:float;x:float):float功能:返回x以n为底的对数Max原型:function Max(a:Integer;b:Integer):Integerfunction Max(a:Int64;b:Int64):Int64function Max(a:Extended
4、;b:Extended):Extended功能:返回a与b中较大的一个Min原型:function Min(a:Integer;b:Integer):Integerfunction Min(a:Int64;b:Int64):Int64function Min(a:Extended;b:Extended):Extended功能:返回a与b中较小的一个arcsin原型:function arcsin(x:float):float功能:返回x的反正弦值,返回的是弧度指单位arccon原型:function arccon(x:float):float功能:返回x的反余弦值,返回的是弧度指单位tan原型
5、:function tan(x:float):float功能:返回x的正切值,x以弧度为单位cotan原型:function cotan(x:float):float功能:返回x的余切值,x以弧度为单位arcsinh原型:function arcsinh(x:float):float功能:返回双曲线的反正弦arccosh原型:function arccosh(x:float):float功能:返回双曲线的反余弦arctanh原型:function arctanh(x:float):float功能:返回双曲线的反正切sinh原型:function sinh(x:float):float功能:返回
6、双曲线的正弦cosh原型:function sinh(x:float):float功能:返回双曲线的正弦tanh原型:function sinh(x:float):float功能:返回双曲线的正切cycletorad原型:function cycletorad(cycle:float):float功能:返回圆的份数转换成弧度之后的值degtorad原型:function degtorad(deg:float):float功能:返回角度转换成弧度之后的值radtocycle原型:function radtocycle(rad:float):float功能:返回弧度转换成圆的份数之后的值radto
7、deg原型:function radtodeg(rad:float):float功能:返回弧度转换成角度之后的值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功能:返回数组中的
8、最大值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功能:返回数组中的最小值sum原型:function sum(const data:Array of float):floa
9、tfunction sum(const data:PFloat;const N:LongInt):float功能:求数组中所有数之和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中,求平方和放入sumofsqua
10、res中例子:(注:以下全都在已经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:
11、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)
12、: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); /这
13、个不在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:=random
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 国债承销工作管理办法
- 通泰安全培训
- 企业安全生产机构
- 非金属矿物制品业供应链优化与协同创新-洞察及研究
- 生产前检查记录表
- 【正版授权】 IEC 62911:2025 EN-FR Audio,video and information technology equipment - Routine electrical safety testing in production
- 教育心理学视域下的学生心理健康管理策略
- 绿色消费与低碳生活方式的推动-洞察阐释
- 鸟类鸣声的生态位分析与栖息地选择-洞察阐释
- 边缘计算在智能城市中的应用研究-洞察阐释
- 江苏省南通市区直属中学2025年七下数学期末学业水平测试试题含解析
- 2025年微生物学基础与应用试题及答案
- 2025年日本无杆锚项目可行性研究报告
- MDS3400调度交换机的结构39课件
- 空气能维保合同协议
- 2025-2030中国多动症治疗行业市场发展趋势与前景展望战略研究报告
- 企业安全文化建设中急救培训的重要性及策略探讨
- 2024年辽宁沈阳水务集团有限公司招聘笔试真题
- 潍坊交通发展集团有限公司招聘笔试题库2025
- 胸痛中心质控管理
- 2025时政试题及答案(100题)
评论
0/150
提交评论