They round to non-infinite values (the maximum and minimum representable finite values). This is not ideal, of course, but the relative error stays bounded, unlike with rounding to infinity.
Additionally, they have a neat encoding that makes the size of the mantissa and exponent fields variable. (The whole bitsize of the number is fixed at 32 or 64 bits though.) This allows to have "tapered" accuracy at super large and extra tiny numbers, which allows for more gradual under- and overflow, and buys more accuracy where most of the calculations tend to be done, around 1.
Additionally, they have a neat encoding that makes the size of the mantissa and exponent fields variable. (The whole bitsize of the number is fixed at 32 or 64 bits though.) This allows to have "tapered" accuracy at super large and extra tiny numbers, which allows for more gradual under- and overflow, and buys more accuracy where most of the calculations tend to be done, around 1.