Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the integer component of an expression.
string An expression that resolves to a number or numeric string.
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.
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