Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function Round(X: Extended): Int64
Rounds a real number to nearest integer number.
If X is exactly halfway betweem two whole values, it is rounded to the one with the greatest absolute magnitude - the even number.
var x1,x2,x3,x4 : extended;
xi1,xi2,xi3,xi4 : integer;
x1 := 2,4;
x2 := -2.4;
x3 := 2.5;
x4 := -2.5;
xi1 := Round(x1);
xi2 := Round(x2);
xi3 := Round(x3);
xi4 := Round(x4);
//xi1 = 2
//xi2 = -2
//xi3 = 2
//xi4 = -2
|
Int,
Trunc,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|