C++ float-to-int conversion can be undefined behavior