It seems to work well with gcc, but in Visual Studio this is problematic. See Microsoft's answer on this issue:
Our floating point to integer conversions are always performed with a signed integer. In this particular, we use the FIST statement, which generates 800..00, as you described. Therefore, there is no specific behavior for converting to unsigned 64-bit integer values ββthat are larger than the largest 64-bit subscription integer.
Thus, you can only convert numbers to a signed 64-bit integer range: -9,223,372,036,854,775,808 - +9,223,372,036,854,775,807 (-2 ^ 63 ~ 2 ^ 63-1).
Igor Oks
source share