Round/de

From Free Pascal wiki
Revision as of 20:45, 22 March 2018 by Useroflazarus (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) Esperanto (eo) suomi (fi) русский (ru)

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) );
  // Beispiele für "Banker-Runden" - .5 wird auf die nächste gerade Zahl eingestellt
  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: