From Free Pascal wiki
Revision as of 22:47, 10 August 2022 by Kai Burghardt (talk | contribs) (→‎Behavior: fix previous edit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en) русский (ru)

The function Int returns the integer part of the argument. It is an UCSD Pascal extension supported by the FPC as an InternProc.


Int has effectively the following signature (actual declaration uses the compiler intrinsic):

function Int(X: Real): Real;

X must be a real-type expression. The result is the integer part of X, rounded toward zero as a real value. It is semantically equivalent to Trunc(X) * 1.0 (Trunc would cause an error if there did not exist an appropriate integer value).


  • Int is used to do a Trunc without leaving the domain of real numbers. This speeds up things and virtually allows a larger range of permissible values. For an example see the implementation of math.FMod.

See also

  • Frac – return fractional part as real
  • Round – return rounded integer value
  • Trunc – return truncated integer value