Int
From Lazarus wiki
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
.
Behavior
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).
Application
Int
is used to do aTrunc
without leaving the domain ofreal
numbers. This speeds up things and virtually allows a larger range of permissible values. For an example see the implementation ofmath.FMod
.