Name

Int Function

Syntax

function Int(X: Floating-point type): Extended

Description

The Int function truncates a floating-point number by discarding its fractional part (rounds toward zero). Note that Int returns a floating-point number. It is not a real function.

Tips and Tricks

  • If X is a signaling NaN, Delphi reports runtime error 6 (EInvalidOp).

  • If X is a quiet NaN, positive infinity, or negative infinity, the result is X.

  • Call Trunc to truncate a floating-point number and obtain an integer-type result.

See Also

Frac Function, Round Function, Trunc Function

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.