fix decimalFormat bug

This commit is contained in:
Looly 2021-05-22 14:40:26 +08:00
parent e5049baa92
commit ad782ff837
3 changed files with 11 additions and 2 deletions

View File

@ -3,7 +3,7 @@
-------------------------------------------------------------------------------------------------------------
# 5.6.6 (2021-05-18)
# 5.6.6 (2021-05-22)
### 🐣新特性
* 【cron 】 增加时间轮简单实现
@ -14,6 +14,7 @@
### 🐞Bug修复
* 【core 】 修复XmlUtil中omitXmlDeclaration参数无效问题issue#1581@Github
* 【core 】 修复NumberUtil.decimalFormat参数传错的问题issue#I3SDS3@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.6.5 (2021-05-08)

View File

@ -1082,7 +1082,7 @@ public class NumberUtil {
if(null != roundingMode){
decimalFormat.setRoundingMode(roundingMode);
}
return decimalFormat.format(roundingMode);
return decimalFormat.format(value);
}
/**

View File

@ -161,6 +161,14 @@ public class NumberUtilTest {
Assert.assertEquals("299,792,458", format);
}
@Test
public void decimalFormatDoubleTest() {
Double c = 467.8101;
String format = NumberUtil.decimalFormat("0.00", c);
Assert.assertEquals("467.81", format);
}
@Test
public void decimalFormatMoneyTest() {
double c = 299792400.543534534;