【发布时间】:2012-09-10 07:00:19
【问题描述】:
嗨,我想将双精度值转换为 6 点,例如如果值为
-1.00005522000
应该转换成
-1.000055
我知道有很多解决方案,但我仍然无法获得价值
如果我使用像
这样的值 : -1.79769313486231E308
结果值变成
-9.22337203668547
我用过类似的参考
http://www.roseindia.net/java/beginners/RoundTwoDecimalPlaces.shtml
How to print upto two decimal places in java using string builder?
Using double up to two decimal places
但没有得到解决方案,所以请任何人可以帮助我?
【问题讨论】:
-
拒绝第一个链接做得很好,但第三个包含答案。