Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In java, when the converter is forced to convert float into int, should it be rounded or just throw away the decimal part?
In java, when the converter is forced to convert float into int, should it be rounded or just throw away the decimal part?
Discard the decimal directly.

For example:

Int 3. 14, the result is

Int is a function that rounds numbers down to the nearest integer. INT is an integer function among the common functions in the database, which is often used to judge whether one number can be divisible by another.

Extended data:

Matters needing attention in using int function:

1, syntax int(number) where number is a real number that needs to be rounded down.

2.int function does not round, but directly removes the decimal part to round.

The 3.int function always carries the decimal number of a negative number.