public class TestFloatEq1 { public static void main(String[] args) { double x, y; x = 2.2 + 2.2 + 2.2 + 2.2 + 2.2 + 2.2 + 2.2 + 2.2 + 2.2 + 2.2; // x = 21.999999999999996 y = 22.0; // y = 22.0 if ( x == y ) System.out.println("x is equal to y"); else System.out.println("x is NOT equal to y"); } }