Delphi取整函式

2022-03-31 11:44:49 字數 527 閱讀 9331

function int(x: extended): extended;//取整 注意它返回的是extended型別它也是浮點型哦

function round(x: extended): int64;//四捨五入

function trunc(x: extended): int64;//將小數無條件捨去

floor 直接往小的取,比如 floor(-123.55)=-124,floor(123.55)=123

trunc 直接切下整數,比如 trunc(-123.55)=-123, floor(123.55)=123

ceil 直接往大的取,比如 ceil(-123.55)=-123, ceil(123.55)=124

round 計算四捨五入,比如 round(-123.55)=-124,round(123.55)=124

floor 和 ceil 是 math unit 裡的函式,使用前要先 uses math。

trunc 和 round 是 system unit 裡的函式,預設就可以用。

Delphi取整函式

floor 和 ceil 是 math unit 裡的函式,使用前要先 uses math。trunc 和 round 是 system unit 裡的函式,預設就可以用。floor 直接往小的取,比如 floor 123.55 124,floor 123.55 123 trunc 直接切下整數,比...

下取整函式的含義 取整函式解讀

關於 x 以及 的性質與應用摘要 x和x是非常重要的數論函式 其他許多數學分支都要涉及到,在國 內外的數學競賽中也經常出現含有x和 x的問題 這類問題新穎獨特 頗具啟發性。本文主要討論x以及 x的性質,和x以及 x在數學中的應用,以及x 以及x在數學競賽中的應用。取整函式 小數函式 性質 應用 例題...

MS SQL取整函式

兩個整數相除將截斷小數部分 select 3 4,4 3,5 3 結果 0,1,1 返回大於或等於所給數字表示式的最小整數 select ceiling 123.55 ceiling 123.45 ceiling 123.45 ceiling 0.0 結果 124,124,123,0 四捨五入 ro...