四舍五入的函数是什么???
解决方案 »
- 请问零基础学delphi7需要什么?
- Delphi程序错误!
- 帮忙
- 下面一段代码表示什么意思我不能理解?
- 报表打印中的查询问题........................................................
- 请教一个从sql语句中取值的问题。谢谢 。。。
- 关于使用StringGrid的问题
- 请问切换窗口的问题
- FORM1.PRINT只能在设定的纸中打印一份FORM1.但我试过如果改变打印纸的大小,如2410*2800的纸,改2410*1400,用两年FORM1.PRINT即可在一张纸上打印二份,但问题是如何在程序中改变打印纸的大小呢?请教各位.
- commandtext does not return a result set
- 我们知道TSocketConnection比较好用。但不是稳定。。不知那位高手肯与小弟一些
- 从Tbitmap中直接将信息写入buffer中
Returns the value of X rounded to the nearest whole number.
function Round(X: Extended): Int64;DescriptionThe 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.
n1,n2 : Integer;
begin
n1 := Trunc(FloatNum);
n2 := Round(FloatNum * 10 - n1 *10)
if n2 > 4 then
n1 := n1 + 1;
end;
var
BaseNum :Extended ;
begin
BaseNum := Power(10, APrec) ;
Result := Round(X * BaseNum + 5 / BaseNum) / BaseNum ;
end;
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;