Created
December 27, 2018 05:35
-
-
Save cmygit/2441e2107af65adda638758b0dc119f5 to your computer and use it in GitHub Desktop.
double
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 保留小数点后2位 | |
Double d = 1.23456; | |
BigDecimal b = new BigDecimal(d); | |
// BigDecimal.ROUND_HALF_EVEN 银行家舍入法 | |
d = b.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment