contents.gifindex.gifprev1.gifnext0.gif

Int

Purpose

Return the integer portion of a number.

Arguments

Int( number )

Notes

The argument number can be any valid numeric expression. Both Int and Fix remove the fractional part of number and return the resulting integer value.

The data type of the return value is the same as that of the number argument. However, if number is a Variant of VarType 8 (String) that can be converted to a number, the return type will be a Variant of VarType 5 (Double). If the numeric expression results in a Null, Int and Fix return a Null.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas 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.

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number))

Example

This example illustrates the difference between Int and Fix. Int returns -100, and Fix returns -99.

X = Int(-99.8)

Y = Fix(-99.8)