Binary Overflow & Underflow

Fill in the blanks

In binary addition, overflow occurs when the sum of two binary numbers exceeds the representable value. This happens because binary numbers have a specific of representable values based on the number of bits they contain. When the sum exceeds this range, the result cannot be accurately represented, resulting in an overflow.



Let's consider a simple 4-bit binary addition, 1101 + 0101, where we want to store the result in a register. The sum of these two numbers is 10010. However, since we are working with only 4 bits, the most significant bit (MSB) of the sum (1) cannot be represented, resulting in overflow. The result therefore is that we the most significant bit, which gives us an answer of 0010.



On the other hand, underflow occurs when subtraction is performed on binary numbers, and the result is smaller than the representable value. Just like overflow, underflow happens because binary numbers have limits on the representable values based on the number of bits used. Suppose we have a 5-bit binary subtraction: 01010 - 10101. The result of this subtraction is -10011. However, in a 5-bit representation, the leftmost bit is used to indicate the , and therefore, -10011 cannot be accurately represented in 5 bits, causing underflow.

Keywords

sign | range | discard | minimum | maximum | 4-bit |