Skip to main content

Int

Returns the integer portion of a number.

Synopsis

Int(number)

Arguments

The number argument can be any valid numeric expression.

Description

Int removes the fractional part of number and returns the resulting integer value. The Int and Fix functions are almost functionally identical:

For positive values, both Int and Fix truncate number. If you wish to round a number to the nearest integer, use the Round function.

For negative values, Int returns the first negative integer less than or equal to number. Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

Both Int and Fix remove leading zeros and plus signs from number.

Examples

The following examples illustrate how the Int and Fix functions return integer portions of numbers:

Println Int(99.8)      ' Returns 99.
Println Fix(99.8)      ' Returns 99.
Println Int(+99.20)    ' Returns 99.
Println Fix(+0099.2)   ' Returns 99.
Println Int(0.00)      ' Returns 0.
Println Fix(0.00)      ' Returns 0.
Println Int(-99.8)     ' Returns -100.
Println Fix(-99.8)     ' Returns -99.
Println Int(-99.2)     ' Returns -100.
Println Fix(-99.2)     ' Returns -99.

See Also

FeedbackOpens in a new tab