lang • int

Int

Value = Int ( Number )

Returns the mathematical integer part of Number, i.e. the greatest integer which is less than Number.

Examples

Print Int(Pi)
Print Int(- Pi)
3
-4

The behaviour of Int and Fix is the same for positive numbers, and is different for negative numbers.

Examples

' Example illustrate the use of Int function to truncate to whole number.
' See also Cint function (for similar example).

 Print Int(3.2)
 Print Int(3.9)
 Print Int(6)
 Print Int(-7.2)
 Print Int(-7.9)
3
3
6
-8
-8

The Value is not limited to the Integer size (32 bits) nor to the Long size (64 bits). It may be Float.

Print Int(2e60), CInt(2e60)
2E+60	-2147483648

The next example shows how Int() works on a Boolean variable.

Print Int(True)
True

The difference between Int() and CInt() is:

See also