52
Digital Electronics
2. (AF1.B3) 16 = (101011110001.10110011) 2 and (FFF.E) 16 = (111111111111.1110) 2 . (1111111111
11.1110) 2 can also be written as (111111111111.11100000) 2 to have the same number of bits in
the integer and fractional parts. The two numbers can now be added as follows:
010101111000110110011
011111111111111100000
110101111000110010011
The hexadecimal equivalent of (1101011110001.10010011) 2 is (1AF1.93) 16 , which is equal to the
hex addition of (AF1.B3) 16 and (FFF.E) 16 .
Example 3.2
Find out whether 16-bit 2’s complement arithmetic can be used to add 14 276 and 18 490.
Solution
The addition of decimal numbers 14 276 and 18 490 would yield 32 766. 16-bit 2’s complement
arithmetic has a range of −2
15 to +(2
15
− 1), i.e. −32 768 to +32 767. The expected result is inside
the allowable range. Therefore, 16-bit arithmetic can be used to add the given numbers.
Example 3.3
Add −118 and −32 firstly using eight-bit 2’s complement arithmetic and then using 16-bit 2’s
complement arithmetic. Comment on the results.
Solution
• −118 in eight-bit 2’s complement representation = 10001010.
• −32 in eight-bit 2’s complement representation = 11100000.
• The addition of the two numbers, after disregarding the final carry in the ninth bit position, is
01101010. Now, the decimal equivalent of (01101010) 2 , which is in 2’s complement form, is +106.
The reason for the wrong result is that the expected result, i.e. −150, lies outside the range of
eight-bit 2’s complement arithmetic. Eight-bit 2’s complement arithmetic can be used when the
expected result lies in the range from −2
7 to + (2
7
− 1), i.e. −128 to +127. −118 in 16-bit 2’s
complement representation = 1111111110001010.
• −32 in 16-bit 2’s complement representation = 1111111111100000.
• The addition of the two numbers, after disregarding the final carry in the 17th position, produces
1111111101101010. The decimal equivalent of (1111111101101010) 2 , which is in 2’s complement
form, is −150, which is the correct answer. 16-bit 2’s complement arithmetic has produced the
correct result, as the expected result lies within the range of 16-bit 2’s complement notation.
3.3 Subtraction of Larger-Bit Binary Numbers
Subtraction is also done columnwise in the same way as in the case of the decimal number system.
In the first step, we subtract the LSBs and subsequently proceed towards the MSB. Wherever the
subtrahend (the bit to be subtracted) is larger than the minuend, we borrow from the next adjacent
Digital Electronics
2. (AF1.B3) 16 = (101011110001.10110011) 2 and (FFF.E) 16 = (111111111111.1110) 2 . (1111111111
11.1110) 2 can also be written as (111111111111.11100000) 2 to have the same number of bits in
the integer and fractional parts. The two numbers can now be added as follows:
010101111000110110011
011111111111111100000
110101111000110010011
The hexadecimal equivalent of (1101011110001.10010011) 2 is (1AF1.93) 16 , which is equal to the
hex addition of (AF1.B3) 16 and (FFF.E) 16 .
Example 3.2
Find out whether 16-bit 2’s complement arithmetic can be used to add 14 276 and 18 490.
Solution
The addition of decimal numbers 14 276 and 18 490 would yield 32 766. 16-bit 2’s complement
arithmetic has a range of −2
15 to +(2
15
− 1), i.e. −32 768 to +32 767. The expected result is inside
the allowable range. Therefore, 16-bit arithmetic can be used to add the given numbers.
Example 3.3
Add −118 and −32 firstly using eight-bit 2’s complement arithmetic and then using 16-bit 2’s
complement arithmetic. Comment on the results.
Solution
• −118 in eight-bit 2’s complement representation = 10001010.
• −32 in eight-bit 2’s complement representation = 11100000.
• The addition of the two numbers, after disregarding the final carry in the ninth bit position, is
01101010. Now, the decimal equivalent of (01101010) 2 , which is in 2’s complement form, is +106.
The reason for the wrong result is that the expected result, i.e. −150, lies outside the range of
eight-bit 2’s complement arithmetic. Eight-bit 2’s complement arithmetic can be used when the
expected result lies in the range from −2
7 to + (2
7
− 1), i.e. −128 to +127. −118 in 16-bit 2’s
complement representation = 1111111110001010.
• −32 in 16-bit 2’s complement representation = 1111111111100000.
• The addition of the two numbers, after disregarding the final carry in the 17th position, produces
1111111101101010. The decimal equivalent of (1111111101101010) 2 , which is in 2’s complement
form, is −150, which is the correct answer. 16-bit 2’s complement arithmetic has produced the
correct result, as the expected result lies within the range of 16-bit 2’s complement notation.
3.3 Subtraction of Larger-Bit Binary Numbers
Subtraction is also done columnwise in the same way as in the case of the decimal number system.
In the first step, we subtract the LSBs and subsequently proceed towards the MSB. Wherever the
subtrahend (the bit to be subtracted) is larger than the minuend, we borrow from the next adjacent
