public class ToleranceTest { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ double d1 = 0.1 + 0.2; double d2 = 0.3; if (Math.abs(d1 - d2) < 0.000001) { System.out.println("等しいと判断する"); } } }