4 ms·
this is a very interesting feature: 8<------------------ If adding a value to a type where the result exceeds the type's maximum capacity in either the positi
by zem 3y ago
this is a very interesting feature:
8<------------------
If adding a value to a type where the result exceeds the type's maximum capacity in either the positive or negative direction, the type must remain at its previous value.
Note
This means that if you add 1 to an int at value 2^31, it will stay at 2^31. This is also called "saturating" a value.