package test;
public class TestDouble {
public static void main(String[] args) {
// TODO 自动生成的方法存根
System.out.println("0.05 + 0.01 = " + (0.05 + 0.01));
System.out.println("1.0 - 0.42 = " + (1.0 - 0.42));
System.out.println("4.015 * 100 = " + (4.015 * 100));
System.out.println("123.3 / 100 = " + (123.3 / 100));
System.out.println("0.1/5="+(0.1/5));
}
}
结论:
double类型的数值进行计算,结果是不精确的