RoundingMode arguments detailed

RoundingMode several models, specifically what rounding behavior? See API completely did not understand, but fortunately, it was concluded over:

https://blog.csdn.net/alanzyy/article/details/8465098

Here is my understanding of the graphics of this article, individuals feel better in mind, specific examples can be seen on top of the original:

UP
positive number to the right by a negative number on the left

DOWN
and up the opposite, to the left by a positive number, a negative number on the right side

CEILING
full right to rely, to a large move closer

FLOOR
with CEILING the contrary, the whole left rely on, move closer to the small

HALF_UP
no map, stating: rounding

HALF_DOWN
no map, stating: Five off and six

HALF_EVEN
bankers rounding, this is very shameless, stating: The target is an even number, you can use rounding, you can also apply for five pieces of six up, specifically to see which side is closer to an even number

UNNECESSARY
reading the feeling is, you need to give it the number of bits is not 0, they reported abnormal ArithmeticException. If you need to give it a digit is zero, it returns the knot give it a normal result.

Transfer: https: //blog.csdn.net/hantangduhey/article/details/83508068 

Guess you like

Origin blog.csdn.net/qq_39158142/article/details/90609515