Detailed Video Explanation of Sign Extension in ALL Number Representations: https://youtu.be/dkoaDtyiz9k
$\color{red}{\text{Sign Extension in Various Number Representations:}}$
Consider an n-bit binary number: $a_n a_{n-1} \dots a_1.$ If we want to store/copy this number in $n+r$ bits, then in various number representations, it is carried out in different ways, keeping the number same, with same sign & magnitude.
1. Unsigned Representation:
Pad $r$ $0's$ to the left. So, we get: $000 \dots 0a_n a_{n-1} \dots a_1.$
For example: If $r = 3,$ we get: $000a_n a_{n-1} \dots a_1.$
2. Sign Magnitude Representation:
Keep the MSB same as original binary number i.e. $a_n.$
Pad $r$ $0's$ after the MSB, then the magnitude $a_{n-1} \dots a_1.$.
So, we get: $a_n000 \dots 0a_{n-1} \dots a_1.$
For example: If $r = 3,$ we get: $a_n000a_{n-1} \dots a_1.$
3. 1's Complement Representation:
Copy the MSB $a_n,$ $r$ extra times to the left.
So, we get: $a_na_n \dots a_na_na_{n-1} \dots a_1.$
For example: If $r = 3,$ we get: $a_na_na_na_na_{n-1} \dots a_1.$
4. 2's Complement Representation:
Copy the MSB $a_n,$ $r$ extra times to the left.
So, we get: $a_na_n \dots a_na_na_{n-1} \dots a_1.$
For example: If $r = 3,$ we get: $a_na_na_na_na_{n-1} \dots a_1.$
Detailed Video Explanation of Sign Extension in ALL Number Representations: https://youtu.be/dkoaDtyiz9k
Related Important Lectures:
Range of Binary Numbers in ALL Representations: https://youtu.be/JxK_KfSa4GY