Skip to content

Commit 079caef

Browse files
bugfix: NumberUtils.doubleToString(Double d),传入较小数字时报 NumberFormatException 的问题修复。
1 parent eb30534 commit 079caef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core-parent/core/src/main/java/icu/easyj/core/util/NumberUtils.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public static String convertScientificToNormal(String scientificNumberStr) {
6565
}
6666

6767
public static String doubleToString(Double d) {
68-
return convertScientificToNormal(d.toString());
68+
String doubleStr = d.toString();
69+
if (doubleStr.contains("E")) {
70+
return convertScientificToNormal(doubleStr);
71+
} else {
72+
return doubleStr;
73+
}
6974
}
7075

7176
}

0 commit comments

Comments
 (0)