Why does >= operator work as > operator in C when compared with 0.9 [duplicate]
Your code is equivalent to: double x1 = 0.9; float xf = (float)x1; // discard some precision double x2 = (double)xf; if (x2 >= x1) { // … } The problem is that, after you discarded some precision from x1 by converting it to float, it can never be recovered; casting it back to double … Read more