Very strange behavior from floor()

MichaelMeissner:
... if x had been a non-const static or global variable, and was initialized to 8.0001, it generally would have to assume that the value could vary, and call the floor function.

And that's exactly what I get with x declared as a global variable. The whole calculation appears in the code, at any optimization level.