|
|
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)
返回
函数名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是一个浮点数,返回值也是个浮点数)
返回
函数名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.
网友评论:(评论内容只代表网友观点,与本站立场无关!) |
阅读排行
|