maskofa

Pembulatan

Oct 29th, 2019
680
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.41 KB | None | 0 0
  1. function PembulatanLease(AReal: Real): Int64;
  2. var
  3.   base: Integer;
  4. begin
  5.   if Pembulatan.Active then
  6.   begin
  7.     case Pembulatan.Kind of
  8.       1 : base := floor(AReal / Pembulatan.Amount);
  9.       2 : base := round(AReal / Pembulatan.Amount);
  10.       3 : base := ceil(AReal / Pembulatan.Amount);
  11.  
  12.       else base := 0;
  13.     end;
  14.  
  15.     result := base * Pembulatan.Amount;
  16.   end else
  17.   result := trunc(AReal);
  18. end;
Advertisement