That is, the int(x) function is the largest integer not greater than X.
For example:
1、int(4.88)=4
Int(4.88) is an integer not greater than 4.88, which is closest to 4.88, so int(4.88)=4.
2、int(8. 1)=8
Int(8. 1) is an integer not greater than 8. 1 and closest to 8, so int(8. 1)=8.
3、int(-5.6)=-6
Nt(-5.6) is an integer not greater than -5.6, which is closest to -5.6, so int(-5.6)=-6.
Extended data:
A function similar to the int function.
Fix function: the Fix function will delete the decimal part of this number and return the remaining integers.
The difference between Fix function and int function:
1、Fix(99.2)= 99;
int(99.8) =99 .?
The Fix function directly deletes the decimal part 0.2, and takes 99,; The int function takes an integer not greater than 99.8, so it takes 99.
2、Fix(-99.8)=-99;
int(-99.8)=? - 100。
The Fix function directly deletes the decimal part of 0.8, and takes -99,; The int function takes an integer not greater than -99.8, so it takes-100.
3、Fix(-99.2) =? -99;
Int(-99.2) =? - 100。
The Fix function directly deletes the decimal part 0.2, and takes -99,; The int function takes an integer not greater than -99.2, so it takes-100.
References:
Baidu encyclopedia -int function
References:
Baidu encyclopedia -Visual Basic