Name
Fix Function — Microsoft.VisualBasic.Conversion
Synopsis
Fix(number
)
number
required; Double or any numeric expressionA number whose integer portion is to be returned
Return Value
A number of the same data type as number
whose value is the integer portion of
number
Description
For nonnegative numbers, Fix returns the floor
of the number (the largest integer less than or equal to
number
). For negative numbers,
Fix returns the ceiling of the number (the
smallest integer greater than or equal to
number
). If
number
is Nothing
,
Fix returns Nothing
.
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 Int(3.14)
and
Fix(3.14)
return 3. If
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).
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.