Current location - Training Enrollment Network - Mathematics courses - What's the difference between int and fix functions in vb?
What's the difference between int and fix functions in vb?
The int function returns the integer value rounded down from the real number. Its syntax format is int (number), where number is a real number that needs rounding. For example, the return value of int( 8.6) is 8, and that of int(-8.6) is -9.

The differences between int function and fix function are: different integers, different negative integers and different conversions.

First, rounding is different.

1, int function: the int function rounds down a floating point number, that is, it is less than or equal to the largest integer of the floating point number.

2.fix function: the fix function directly rounds the decimal part.

Second, negative integers are different.

1, int function: the int function returns the first negative integer less than or equal to number.

2.fix function: the fix function returns the first negative integer greater than or equal to number.

Third, the conversion is different.

1, int function: int function can be converted into fix function.

2.fix function: fix function cannot be converted into int function.