I've been reading up a bit on the standard representation of floats, and I kind of understood that numbers with a zero fractional part, e.g. 5.0, 9.0, can be exactly represented. Is this correct?
In general, multiples of powers of two, given that the sign, significand and exponent can each be represented within the number of bits allotted to them, can be represented exactly.
That's because 123456789 is too large to fit in the number of bits used as the significand for a 32 bit floating point number. It's also true of 16777217. Because the significand cannot store the number alone using an exponent of 0, you are forced to approximate it as a number with a smaller significand multiplied by some power of 2.