Integer overflow
Integer overflow is a phenomenon that occurs when an arithmetic operation on two integers produces a result that is larger than the maximum value that can be represented by the data type of the integers. In most programming languages, this will cause the result of the operation to wrap around to the minimum value that can be represented by the data type, which can lead to unexpected and potentially incorrect results.
For example, consider the following code in the C programming language:
Integer underflow
The opposite of an overflow is an underflow. An underflow occurs when an arithmetic operation on two numbers produces a result that is smaller than the minimum value that can be represented by the data type of the numbers. This can also lead to unexpected and potentially incorrect results, depending on how the underflow is handled by the programming language or system.
For example, consider the following code in the C programming language:
Last updated