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

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

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

函数名 poly(本条翻译无把握)
简要介绍: Evaluates a uniform polynomial of one variable at the value X.
所属单元: Math
定义: function Poly(X: Extended; const Coefficients: array of Double): Extended;
详细解释:



Call Poly to evaluate the polynomial represented by the Coefficients parameter at the point where the variable equals the value of the X parameter. The coefficients are ordered in increasing powers of X:

Coefficients[0] + Coefficients[1]*X + ... + Coefficients[N]*(X**N)
(Poly估计一个变量在同一多项式的X值。调用Poly评估由Coefficients参数表达的多项式在一位置的值等同于X参数的值。参数是顺序的以X的幂增加:Coefficients[0]+
coefficients[1]*X+…..+Cofficients[n]*[X**N])



函数名 power
简要介绍: Raises Base to any power.(取一个实数的幂)
所属单元: Math
定义: function Power(Base, Exponent: Extended): Extended;
详细解释:



Power raises Base to any power. For fractional exponents or exponents greater than MaxInt, Base must be greater than 0.
(返回一个实数的幂。 当指数Exponent为小数或大于MaxInt时,底数Base必须大于0.)



函数名 Round
简要介绍: Returns the value of X rounded to the nearest whole number.(对一个实数进行四舍五入)
所属单元: System
定义: function Round(X: Extended): Int64;
详细解释:



The Round function rounds a real-type value to an integer-type value.

X is a real-type expression. Round returns an Int64 value that is the value of X rounded to the nearest whole number. If X is exactly halfway between two whole numbers, the result is always the even number.

If the rounded value of X is not within the Int64 range, a run-time error is generated, which can be handled using the EInvalidOp exception.

(Round返回X向最近整数值的舍入。
函数将一个实型值舍入为一个整型值。X是一个实型表达式。Round返回一个长整型值,是离X最近的整数值。如果X是两个整数值的正中间,结果是绝对值最大的一个。如果X的舍入值不是在长整型范围内,一个运行时间错误将产生,可以使用EinvalidOp异常来处理)

范例: var

S, T: string;

begin

Str(1.4:2:1, T);
S := T + ' rounds to ' + IntToStr(Round(1.4)) + #13#10;
Str(1.5:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(1.5)) + #13#10;
Str(-1.4:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(-1.4)) + #13#10;
Str(-1.5:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(-1.5));
MessageDlg(S, mtInformation, [mbOk], 0);
end;


函数名 Sqr
简要介绍: Returns the square of a number.(取给定值的平方)
所属单元: System
定义: function Sqr(X: Extended): Extended;
详细解释:



The Sqr function returns the square of the argument.

X is a floating-point expression. The result, of the same type as X, is the square of X, or X*X.
(Sqr返回X得平方值,X是一个浮点型的数,返回值的类型与X 相同,值为X*X)

范例: var
S, Temp: string;
begin
Str(Sqr(5.0):3:1, Temp);
S := '5 squared is ' + Temp + #13#10;
Str(Sqrt(2.0):5:4, Temp);
S := S + 'The square root of 2 is ' + Temp;
MessageDlg(S, mtInformation, [mbOk], 0);
end;


函数名 sqrt
简要介绍: Returns the square root of X.
所属单元: System
定义: function Sqrt(X: Extended): Extended;
详细解释:



X is a floating-point expression. The result is the square root of X.
(取X的平方根,X是一个浮点数,返回值也是个浮点数)

范例: var
S, Temp: string;
begin
Str(Sqr(5.0):3:1, Temp);
S := '5 squared is ' + Temp + #13#10;
Str(Sqrt(2.0):5:4, Temp);
S := S + 'The square root of 2 is ' + Temp;
MessageDlg(S, mtInformation, [mbOk], 0);
end;



函数名 Trunc
简要介绍: Truncates a real number to an integer.(截取一个实数的整数部分)
所属单元: System
定义: function Trunc(X: Extended): Int64;
详细解释:



The Trunc function truncates a real-type value to an integer-type value. X is a real-type expression. Trunc returns an Int64 value that is the value of X rounded toward zero.

If the truncated value of X is not within the Int64 range, an EInvalidOp exception is raised.

范例: var
S, T: string;
begin
Str(1.4:2:1, T);
S := T + ' Truncs to ' + IntToStr(Trunc(1.4)) + #13#10;
Str(1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(1.5)) + #13#10;
Str(-1.4:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.4)) + #13#10;
Str(-1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.5));
MessageDlg(S, mtInformation, [mbOk], 0);
end;



出处: http://www.togetherdev.com 日期: 2005-4-11
delphi技术热门文章排行
网站赞助商
购买此位置

 

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

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