Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

INT

Returns the integer component of an expression.

Synopsis

INT(string)

Arguments

string An expression that resolves to a number or numeric string.

Description

The INT function returns the integer portion of a numeric or numeric string. It returns both positive and negative integers. Fractional numbers are truncated (not rounded) to an integer. A zero, an empty string (""), or a non-numeric string all return the integer 0.

For numbers and numeric strings, prior to determining the integer, MVBasic performs all arithmetic operations and converts numbers to canonical form, with leading and trailing zeroes, a trailing decimal point, and all signs removed except a single minus sign.

Examples

The following examples all use the INT function to return the integer 321:

PRINT INT(321.37);        ! Returns 321
PRINT INT(321.99);        ! Returns 321
PRINT INT("--00321.6");   ! Returns 321
PRINT INT("321blastoff"); ! Returns 321

See Also

Feedback