Conversion.Fix Method (Int64)
Return the integer portion of a number.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
For more detailed information, see the Visual Basic topic Int, Fix Functions (Visual Basic).
Both the Int and Fix functions remove the fractional part of Number and return the resulting integer value.
The difference between Int and Fix functions is that if Number is negative, Int returns the first negative integer less than or equal to Number, whereas Fix returns the first negative integer greater than or equal to Number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.
Fix(number) is equivalent to Sign(number) * Int(Abs(number)).
This example illustrates how the Int and Fix functions return integer portions of numbers. In the case of a negative number argument, the Int function returns the first negative integer less than or equal to the number; the Fix function returns the first negative integer greater than or equal to the number. The following example requires you to specify Option Strict Off because implicit conversions from type Double to type Integer are not allowed under Option Strict On:
You can use the CInt function to explicitly convert other data types to type Integer with Option Strict Off. However, CInt rounds to the nearest integer instead of truncating the fractional part of numbers. For example:
You can use the CInt function on the result of a call to Fix or Int to perform explicit conversion to integer without rounding. For example:
For more information on CInt, see Type Conversion Functions.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.