电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> delphi技术>>Delphi中的算术运算函数(1):

Delphi中的算术运算函数(1)

来源:www.cncfan.com | 2006-1-10 | (有2433人读过)

函数名 ABS
简要介绍: Returns an absolute value. (取绝对值)
所属单元: System
定义: function Abs(X);
详细解释:
Abs returns the absolute value of the argument, X.
X is an integer-type or real-type expression.
(Abs函数用于返回变量X的绝对值,X可以是一个整形的变量或实数型的变量)

函数名 ceil
简要介绍: Rounds variables up toward positive infinity.
所属单元: Math
定义: function Ceil(X: Extended):Integer
详细解释: Call Ceil to obtain the lowest integer greater than or equal to X. The absolute value of X must be less than MaxInt. For example:
Ceil(-2.8) = -2
Ceil(2.8) = 3
Ceil(-1.0) = -1
(调用ceil函数,返回大于或等于x的最小整数值。X的绝对值一定要小于最大整数值。例如:
Ceil(-2.8) = -2

Ceil(2.8) = 3

Ceil(-1.0) = -1)



函数名 Exp
简要介绍: Returns the exponential of X.(Exp函数返回自然对数基底E的X次幂。)
所属单元: System
定义: function Exp(X: Real): Real;
详细解释:




Exp returns the value of e raised to the power of X, where e is the base of the natural logarithms.
(Exp返回e的X次幂的值,其中e是一个自然对数基底。)

范例: var
e : real;
S : string;
begin
e := Exp(1.0);
Str(ln(e):3:2, S);
S := 'e = ' + FloatToStr(e) + '; ln(e) = ' + S;
Canvas.TextOut(10, 10, S);
end;


函数名 Floor
简要介绍: Rounds variables toward negative infinity.(取小于给定值的最大整数)
所属单元: Math
定义: function Floor(X: Extended): Integer;
详细解释:




Call Floor to obtain the highest integer less than or equal to X. For example:

Floor(-2.8) = -3

Floor(2.8) = 2

Floor(-1.0) = -1

Note: The absolute value of X must be less than MaxInt.

(使用Floor函数以取得小于等于X的最大的整数,如:
Floor(-2.8) = -3

Floor(2.8) = 2

Floor(-1.0) = -1

注意:X的绝对值必须小于整形数的最大值)



函数名 Frac
简要介绍: Returns the fractional part of a real number(返回一个实数的小数部分)
所属单元: System
定义: function Frac(X: Extended): Extended;
详细解释:




The Frac function returns the fractional part of the argument X.

X is a real-type expression. The result is the fractional part of X; that is, Frac(X) = X - Int(X).

(Frac函数返回参数X的小数部分,X是一个实型数,该函数的作用等价于Frac(X)=X-Int(X)。)

范例: var
a,b:Real;
begin
a := 1.54;
b := frac(a);
end;
此时,a= 1.54,b=0.54

delphi技术热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号