Rounds variables up toward positive infinity.UnitMath HELP里的详细说明如下: CategoryArithmetic routinesDelphi syntax:function Ceil(const X: Extended):Integer;C++ syntax:extern PACKAGE int __fastcall Ceil(const Extended X);DescriptionCall 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) = -2Ceil(2.8) = 3Ceil(-1.0) = -1
i := (m)div(n);
i1 := (m)mod(n);
if i1>0 then
i := i+1;
3.999.....999取整为4
4.8192.23238474取整为5
5.0取整为5
5.1取整为6
result := Int(X) + 1
else
result := Int(X);
如果取下限整数用FLOOR(地板)
楼主太懒惰了,这样的问题去HELP里找一下就好了。
HELP里的详细说明如下:
CategoryArithmetic routinesDelphi syntax:function Ceil(const X: Extended):Integer;C++ syntax:extern PACKAGE int __fastcall Ceil(const Extended X);DescriptionCall 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) = -2Ceil(2.8) = 3Ceil(-1.0) = -1
begin
if abs(Value - Trunc(Value)) > 0 then
Result := Trunc(Value) + 1
else
Result := Trunc(Value);
end;