number(required; Double or any numeric expression)
A number whose integer portion is to be returned
A number of the same data type as
whose value is the integer portion of
For nonnegative numbers, Fix returns the floor
of the number (the largest integer less than or equal to
For negative numbers, Fix returns the ceiling of
the number (the smallest integer greater than or equal to
The operation of Int and
Fix are identical when dealing with positive
numbers: numbers are rounded down to the next lowest whole number.
For example, both
Fix(3.14) return 3.
number is negative,
Fix removes its fractional part, thereby
returning the next greater whole number. For example,
Fix(-3.667) returns -3. This contrasts with
Int, which returns the negative integer less
than or equal to number (or -4, in the case of our example).
The function returns the same data type as was passed to it.
Sub TestFix( ) Dim dblTest As Double Dim objTest As Object dblTest = -100.9353 objTest = Fix(dblTest) ' returns -100 Console.WriteLine(objTest & " " & TypeName(objTest)) dblTest = 100.9353 objTest = Fix(dblTest) 'returns 100 Console.WriteLine(objTest & " " & TypeName(objTest)) End Sub
Fix does not round
number to the nearest whole number; it simply removes the fractional part ...