Round/de
From Lazarus wiki
Jump to navigationJump to search
Rundet eine Fliesskommazahl auf eine Ganzzahl.
Round
Deklaration:
function Round(X: Real): Longint;
Beispiel:
Code:
var
i1, i2: Integer;
begin
WriteLn( Round(8.7) );
WriteLn( Round(8.3) );
// examples of "bankers rounding" - .5 is adjusted to the nearest even number
WriteLn( Round(2.5) );
WriteLn( Round(3.5) );
i := Round(12.50); // Rundet ab
WriteLn(i);
i := Round(12.51); // Rundet auf
WriteLn(i);
end.
Ausgabe:
9
8
2
4
12
13
See also: