一個四捨五入函式 (轉)

worldblog發表於2007-12-06
一個四捨五入函式 (轉)[@more@]一個四捨五入

(2001年4月19日) 作者:booktian 推薦:booktian
下面是保島國整數的四捨五入函式,如果要保島國n位小數,只需簡單修改。
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;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-989004/,如需轉載,請註明出處,否則將追究法律責任。

相關文章