DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Cast a floating point number (e.g. real) to an integer

There are a couple of methods to do this conversion.. the results will vary:

   i: integer;
   r: real;
   r := 34.56;
   i := trunc(r);  {i = 34}  { First Method }
   i := round(r);  {i = 35}  { Second Method }

Generated 20:01:20 on Nov 21, 2019