Double转String精度丢失

场景

Double整数部分超6位用科学计数法表示,如123456789.50表为1.234567895E8。

解决

double d = 123456789.50;
DecimalFormat format = new DecimalFormat("#.00");
String str= format.format(d);
System.out.println(str);

猜你喜欢

转载自blog.csdn.net/zsp_android_com/article/details/81172993