mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix decimalFormat bug
This commit is contained in:
@@ -1082,7 +1082,7 @@ public class NumberUtil {
|
||||
if(null != 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);
|
||||
}
|
||||
|
||||
@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;
|
||||
|
Reference in New Issue
Block a user