1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Merge pull request #2663 from 1312255201/patch-2

建议:修改RoundingMode的样例中注释采用的数据
This commit is contained in:
Guide 2025-04-25 07:09:09 +08:00 committed by GitHub
commit 1fc64fca0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,20 +99,20 @@ public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMod
```java
public enum RoundingMode {
// 2.5 -> 3 , 1.6 -> 2
// -1.6 -> -2 , -2.5 -> -3
// 2.4 -> 3 , 1.6 -> 2
// -1.6 -> -2 , -2.4 -> -3
UP(BigDecimal.ROUND_UP),
// 2.5 -> 2 , 1.6 -> 1
// -1.6 -> -1 , -2.5 -> -2
// 2.4 -> 2 , 1.6 -> 1
// -1.6 -> -1 , -2.4 -> -2
DOWN(BigDecimal.ROUND_DOWN),
// 2.5 -> 3 , 1.6 -> 2
// -1.6 -> -1 , -2.5 -> -2
// 2.4 -> 3 , 1.6 -> 2
// -1.6 -> -1 , -2.4 -> -2
CEILING(BigDecimal.ROUND_CEILING),
// 2.5 -> 2 , 1.6 -> 1
// -1.6 -> -2 , -2.5 -> -3
FLOOR(BigDecimal.ROUND_FLOOR),
// 2.5 -> 3 , 1.6 -> 2
// -1.6 -> -2 , -2.5 -> -3
// 2.4 -> 2 , 1.6 -> 2
// -1.6 -> -2 , -2.4 -> -2
HALF_UP(BigDecimal.ROUND_HALF_UP),
//......
}