The compiler could reasonably work out that the arguments passed to it are compile-time constants. You seem to be saying that by definition the return value of a function with arguments known at compile time is also a compile-time constant. That's not generally true. In order to know whether it was true for a given function, you'd need to know how that function is implemented.
The ISO C standard explicitly gives the compiler license to know about all functions defined in the ISO C standard (section 7.1.4), and it is perfectly legitimate for the compiler to optimize calls. Since the C++ language is built on top of C (with some changes, and many additions), I believe it has similar wording in its standard. So since floor
is an ISO C standard function (126.96.36.199 in ISO C99), the GCC compiler can optimize calls that the compiler knows are constant.
I should mention that I was one of the founding members of the original X3J11 ANSI C standard committee (for what would become the ANSI C89 and later ISO C90 standards) and it was an explicit choice of the committee that the compiler should be given freedom to do such optimizations. As I mentioned earlier, GCC does have switches to turn off builtin function handling, but you would have to convince the Arduino IDE to specify that option.