Int and Nat do not have any maximum value, other than what cannot be represented in 4 gigs of memory(*). However, 64 bit floats have, which is the one you have approximated. After that, everything get’s rounded to infinity. And trying to invert float infinity to Int will fail.
I thought the Motoko compiler would warn when a float literal is rounded to infinity, but perhaps I was mistaken.
(*) Though in practice, you will probably run out of cycles before you even get close.