标签:style blog color ar java sp div log bs
1 package com.helen.test; 2 3 import java.math.BigDecimal; 4 5 public class TestBigDecimal { 6 7 /** 8 * @param args 9 */ 10 public static void main(String[] args) { 11 12 double d1=0.31125; 13 double d2=3; 14 System.out.println(d1*d2); //0.9337500000000001 15 16 float f1=0.31125f; 17 float f2=3; 18 System.out.println(f1*f2); //0.93375003 19 20 BigDecimal b1=new BigDecimal(0.31125+""); 21 BigDecimal b2=new BigDecimal(3); 22 BigDecimal b3= b1.multiply(b2); 23 24 System.out.println(b3); //0.93375 25 26 27 28 29 } 30 31 }
标签:style blog color ar java sp div log bs
原文地址:http://www.cnblogs.com/thrive/p/4047811.html