BigDecimal精度问题

 1 package com.wteam.pojo;
 2 
 3 public class Test {
 4     public static void main(String args[]){
 5         double f = 1000.095;
 6 //        BigDecimal price = new BigDecimal(Double.toString(f));
 7         java.text.DecimalFormat df=new java.text.DecimalFormat("0.00");
 8         System.out.println(df.format(f));
 9     }
10 }


result: 1000.10

posted @ 2013-07-10 23:00  FansZone  阅读(206)  评论(0编辑  收藏  举报