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

Returns the integer portion of a number.
The number argument can be any valid numeric expression.
Fix removes the fractional part of number and returns the resulting integer value. The Fix and Int functions are almost functionally identical:
For positive values, both Fix and Int truncate number. If you wish to round a number to the nearest integer, use the Round function.
For negative values, Fix returns the first negative integer greater than or equal to number. Int returns the first negative integer less than or equal to number. For example, Fix converts -8.4 to -8 and Int converts -8.4 to -9.
Both Fix and Int remove leading zeros and plus signs from number.
The following examples illustrate how the Fix and Int functions return integer portions of numbers:
Println Int(99.8)      ' Returns 99.
Println Fix(99.8)      ' Returns 99.
Println Int(+99.20)    ' Returns 99.
Println Fix(+0099.2)   ' Returns 99.
Println Int(0.00)      ' Returns 0.
Println Fix(0.00)      ' Returns 0.
Println Int(-99.8)     ' Returns -100.
Println Fix(-99.8)     ' Returns -99.
Println Int(-99.2)     ' Returns -100.
Println Fix(-99.2)     ' Returns -99.
See Also