Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function Trunc(X: Extended): Int64
Truncates a real number to an integer number.
Trunc converts real X to integer by simply removing any fractional part of X.
var x1,x2,x3,x4 : extended;
xi1,xi2,xi3,xi4 : integer;
x1 := 2.4;
x2 := -2.4;
x3 := 2.5;
x4 := -2.5;
xi1 := Trunc(x1);
xi2 := Trunc(x2);
xi3 := Trunc(x3);
xi4 := Trunc(x4);
//xi1 = 2
//xi2 = -2
//xi3 = 2
//xi4 = -2
|
Int,
Round,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|