mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix decimalFormat bug
This commit is contained in:
parent
e5049baa92
commit
ad782ff837
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.6.6 (2021-05-18)
|
# 5.6.6 (2021-05-22)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【cron 】 增加时间轮简单实现
|
* 【cron 】 增加时间轮简单实现
|
||||||
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复XmlUtil中omitXmlDeclaration参数无效问题(issue#1581@Github)
|
* 【core 】 修复XmlUtil中omitXmlDeclaration参数无效问题(issue#1581@Github)
|
||||||
|
* 【core 】 修复NumberUtil.decimalFormat参数传错的问题(issue#I3SDS3@Gitee)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.6.5 (2021-05-08)
|
# 5.6.5 (2021-05-08)
|
||||||
|
@ -1082,7 +1082,7 @@ public class NumberUtil {
|
|||||||
if(null != roundingMode){
|
if(null != roundingMode){
|
||||||
decimalFormat.setRoundingMode(roundingMode);
|
decimalFormat.setRoundingMode(roundingMode);
|
||||||
}
|
}
|
||||||
return decimalFormat.format(roundingMode);
|
return decimalFormat.format(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,6 +161,14 @@ public class NumberUtilTest {
|
|||||||
Assert.assertEquals("299,792,458", format);
|
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
|
@Test
|
||||||
public void decimalFormatMoneyTest() {
|
public void decimalFormatMoneyTest() {
|
||||||
double c = 299792400.543534534;
|
double c = 299792400.543534534;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user