java的四舍五入的问题
(new DecimalFormat("#.00")).format(5.625) = 5.62 0.005被舍掉了
(new DecimalFormat("#.00")).format(5.625000001) = 5.65 0.0050000001进位了
(new DecimalFormat("#.000")).format(5.6255) = 5.626 0.0005进位了
为啥???
http://download.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
里记载
The value has three digits to the right of the decimal point, but the pattern has only two. The format method handles this by rounding up.
说是rounding up的??
java也搞的是4舍6入,逢5单进双不进????