Int
English · Русский
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
Intis used to do a Trunc without leaving the domain ofrealnumbers. This speeds up things and virtually allows a larger range of permissible values. For an example see the implementation ofmath.FMod.
See also
- Frac – return fractional part as
real - Round – return rounded
integervalue - Trunc – return truncated
integervalue
From the Free Pascal wiki, page "Int", as it stood on 2022-08-10 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
