Three large rounding functions in the math class
1.ceil
2.floor
3.round
In fact, three of the complete function is quite simple. Just remember the three function names translated Chinese can easily understand the three functions, described below
1.ceil, which means ceiling, is called up rounding in Java, and is greater than the nearest integer equal to that number.
Cases:
Math.ceil (13.2) =14
Math.ceil (-13.2) =-13
2.floor, meaning the floor, called down rounding in Java, is less than the nearest integer equal to the number
Cases:
Math.floor (13.2) =13
Math.floor (-13.2) =-14
3.round, the most special, is actually rounding
Cases:
Math.Round (13.2) =13;math.round (13.5) =14
Math.Round ( -13.2) =-13,math.round (-13.5) =-13
The above article on the Java in the math class three of the difference is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.