Purpose
Returns an integer value, obtained by removing the fractional part of a decimal value. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Fix( num_expr )
num_expr is a numeric expression.
Return Value
Integer
Description
The Fix() function removes the fractional portion of a number, and returns the resultant integer value. The Fix() function is similar to, but not identical to, the Int() function. The two functions differ in the way that they treat negative fractional values. When passed a negative fractional number, Fix() returns the nearest integer value greater than or equal to the original value; thus, the function call:
Fix(-2.3)
returns a value of -2. But when the Int() function is passed a negative fractional number, it returns the nearest integer value that is less than or equal to the original value. Thus, the function call:
Int(-2.3)
returns a value of -3.
Example
Dim i_whole As Integer
i_whole = Fix(5.999)
' i_whole now has the value 5.
i_whole = Fix(-7.2)
' i_whole now has the value -7.
See Also:
Int() function, Round() function