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)
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是一个浮点数,返回值也是个浮点数)
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.
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.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




