Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How does Java realize the function of extracting decimal integer parts?
How does Java realize the function of extracting decimal integer parts?
Math class provides three methods related to rounding: upper limit, lower limit and rounding. The functions of these methods correspond to the meanings of their English names. For example, ceiling means rounding, the result of mathematics. Ceil (1 1.3) is 12, Mathematics. Floor means floor in English, so this method means rounding. The result of Math.ceil( 1 1.6) is 1 1, the result of mathematics. Ceil (- 1 1.6) is -65438+. The most difficult to master is the round method, which means "rounding". The algorithm is Math.floor(x+0.5), that is, the original number is rounded down after adding 0.5, so the result of Math.round( 1 1.5) is 12, Math. Circle (-).