lundi 26 décembre 2016

Why is 0.3-0.2 equalling 0.09999999999999998?

Why is that the if statement won't print out "false", however when I enter System.out.print("true"); in the else statement, it'll print out true? In what way are if statements designed in order to execute like that?

   int x, y;
    x = 5;
    y = 6;

    if( x == y && y == x ){
        System.out.println("false");
    }
    else
    {

    }

Aucun commentaire:

Enregistrer un commentaire