标签:
double a = 1.0;
double b = 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1;
System.out.println("a=" + a + ";b=" + b);
System.out.println(a == b);
System.out.println(Math.abs(a - b) < 1e-6);
标签:
原文地址:http://www.cnblogs.com/zoudajia/p/5497767.html