四舍五入问题不用delphi round函数
function RoundFloat(f: double; i: integer): double;
var
s: string;
ef: extended;
begin
s := '#.' + StringOfChar('0', i);
ef := StrToFloat(FloatToStr(f)); //防止浮点运算的误差
result := StrToFloat(FormatFloat(s, ef));
end;
====================================
function GetRound(iValue: double): Double;
var
iTemp: integer;
iMod: Integer;
begin
//先乘1000,用Trunc取整,除10取余,余数再取整,如果大于5,进位,小于5不进位。
iTemp := Trunc(iValue * 1000);
iMod := iTemp mod 10;
if Trunc(iMod) >= 5 then
Result := (Trunc(iValue * 100) + 1) / 100
else
Result := Trunc(iValue * 100) / 100;
end;