Skip to content

INT

Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgInt Last revised: 2025-09-01

Returns the floor of a number.

Syntax

declare function Int ( byval number as single ) as single
declare function Int ( byval number as double ) as double
declare function Int ( byval number as integer ) as integer
declare function Int ( byval number as uinteger ) as uinteger

Usage:

result = Int( number )

Parameters

  • number — The floating-point number to round.

Return Value

Returns the floor of number — the largest integer that is less than or equal to it.

Description

Int returns the floor of number. For example:

  • Int(4.9) returns 4.0
  • Int(-1.3) returns -2.0

For integer types, the number is returned unchanged.

Note: To return the ceiling of number (smallest integer >= number), use -Int(-number).

The Int unary operator can be overloaded with user-defined types.

Examples

vb
Print Int(1.9)   '' will print  1
Print Int(-1.9)  '' will print -2

Dialect Differences

  • In the -lang qb dialect, this operator cannot be overloaded.

Differences from QB

  • None.

See Also

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft