Annex F (informative) Core undefined behavior [ub]

F.3 [expr]: Expressions [ub.expr]

F.3.7[ub:conv.fpint.float.not.represented]
Specified in: [conv.fpint]

When converting a floating-point value to an integer type, if the value is not representable in the destination type, the behavior is undefined.
[Example 1: #include <limits> int main() { // Assuming 32-bit int, the range of values is: to // 2,147,483,647. Assuming 32-bit float and 64-bit double. double d = (double)std::numeric_limits<int>::max() + 1; int x1 = d; // undefined behavior is not representable as int } — end example]