簡單的處理Delphi程式在小數點進位的問題,可以用以下函數:

1
2
3
4
5
6
7
8
9
10
function myRound(x : extended) : extended;
begin
  if (int(x) * 10 + 5) > int(x * 10) then
  begin
  result := floor(x);
  end else
  begin
  result := ceil(x);
  end;
end;
1
這個 myRound()函數會保留小位點一位,需要增加位數可以自己修改。