All integers the width of the mantissa can be represented exactly. And IEEE-754 normalisation rules mean that they will be. So a float can precisely represent integers from -2^24 to 2^24 and a double from -2^53 to 2^53.
So he can safely rely on the test x == (int)x for those ranges.