double num = 0.3; System.out.println(num); System.out.println(num - 0.2); System.out.println(num - 0.2 == 0.1);
结果为
0.3 0.09999999999999998 false