Detailed explanation of several parameters of RoundingMode

ROUND_CEILING:  

Move towards positive infinity when rounding 1.1->2 1.5->2 1.8->2 -1.1->-1 -1.5->-1 -1.8->-1   
ROUND_DOWN:

Move towards 0 by 1.1->1 1.5->1 1.8->1 -1.1->-1 -1.5->-1 -1.8>-1   
ROUND_FLOOR:

Contrary to CEILING, towards negative infinity 1.1->1 1.5->1 1.8->1 -1.1->-2 -1.5->-2 -1.8->-2   
 ROUND_HALF_DOWN:

Take 5 as the dividing line, or round up 1.5->1 1.6->1 -1.5->-1 -1.6->-2 1.15->1.1 1.16->1.2 1.55->1.6 1.56->1.6 ROUND_HALF_EVEN
:

Also use 5 as the dividing line. If it is 5, the previous digit becomes an even number 1.15->1.2 1.16->1.2 1.25->1.2 1.26->1.3   
ROUND_HALF_UP:

The most common rounding   
ROUND_UNNECESSARY:

Without rounding   
ROUND_UP:

With ROUND_DOWN, the directions away from 0 are 1.1->2 1.5->2 1.8->2 -1.1->-2 -1.5->-2 -1.8->-2

Guess you like

Origin blog.csdn.net/bobocqu/article/details/127787912