Binary Number Representation
There are 2 different kind of binary numbers representation.
Unsigned Binary
Unsigned number contains only magnitude of the number.
Representation of Unsigned Binary
8 Bit unsigned number will be used to represent 0 to +255.
(11100101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (0 x 23) + (0 x 24) + (1 x 25) + (1 x 26) + (1 x 27)
=> (229)10
Signed Binary
Signed number contains both sign and magnitude of the number. MSB bit indicates the sign of the number.
Representation of Signed Binary
There are 3 different kind of representation of Signed Binary numbers.
- Sign Bit Magnitude
- 1's complement
- 2's complement
(11100101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (0 x 23) + (0 x 24) + (1 x 25) + (1 x 26)
=> (-101)10
(00000101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (0 x 23) + (0 x 24) + (0 x 25) + (0 x 26)
=> (+5)10
(11100101)2 => 00011010 => (0 x 20) + (1 x 21) + (0 x 22) + (1 x 23) + (1 x 24) + (0 x 25) + (0 x 26) + (0 x 27)
=> (-26)10
(00000101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (0 x 23) + (0 x 24) + (0 x 25) + (0 x 26) + (0 x 27)
=> (+5)10
(11100101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (0 x 23) + (0 x 24) + (1 x 25) + (1 x 26) + ((-1) x 27)
=> (-27)10
(00001101)2 => (1 x 20) + (0 x 21) + (1 x 22) + (1 x 23) + (0 x 24) + (0 x 25) + (0 x 26) + (0 x 27)
=> (+13)10
Representation Table
No comments:
Post a Comment