有沒有一個函數可以無條件進位 1/3 => 1, 2/3 => 1 |
答題得分者是:StrongLemon
|
blk5743
高階會員 發表:34 回覆:371 積分:236 註冊:2003-11-17 發送簡訊給我 |
|
stellos
中階會員 發表:24 回覆:84 積分:51 註冊:2004-06-08 發送簡訊給我 |
|
stellos
中階會員 發表:24 回覆:84 積分:51 註冊:2004-06-08 發送簡訊給我 |
|
blk5743
高階會員 發表:34 回覆:371 積分:236 註冊:2003-11-17 發送簡訊給我 |
|
jow
尊榮會員 發表:66 回覆:751 積分:1253 註冊:2002-03-13 發送簡訊給我 |
|
StrongLemon
高階會員 發表:10 回覆:166 積分:105 註冊:2004-04-18 發送簡訊給我 |
您好,以下節錄自Delphi Help..跟C Builder應該是一樣的 Truncates a real number to an integer.
Delphi syntax: function Trunc(X: Extended): Int64; Rounds variables toward negative infinity.
Delphi syntax: function Floor(const X: Extended): Integer;
Description Call Floor to obtain the highest integer less than or equal to X. For example: Floor(-2.8) = -3 Floor(2.8) = 2 Floor(-1.0) = -1 Rounds variables up toward positive infinity. function Ceil(const X: Extended):Integer; Description Call 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) = -2 Ceil(2.8) = 3 Ceil(-1.0) = -1 Returns the value of X rounded to the nearest whole number. Delphi syntax: function Round(X: Extended): Int64; Rounds a floating-point value to a specified digit or power of ten using ?anker? rounding?
function RoundTo(const AValue: Double; const ADigit: TRoundToRange): Double;
Expression Value RoundTo(1234567, 3) 1234000
RoundTo(1.234, -2) 1.23
RoundTo(1.235, -2) 1.24
RoundTo(1.245, -2) 1.24
|
blk5743
高階會員 發表:34 回覆:371 積分:236 註冊:2003-11-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |