What decimal number does the bit pattern 10101101 represent
What decimal number does the bit pattern 10101101 represent if it is a:
two\'s complement integer?
Solution
Given pattern : 10101101
To calculate two\'s complement integer :
First we need to identify whether the pattern is negative or positive and if negative then convert to positive just by inverting every bit and adding one
Here its negative as it starts with 1 so we will first make it positive:
10101101
01010010 (Inverted bits)
+ 1 (ading one)
01010011
Now we need to conevrt this magnitude to decimal and to do so label each digit as 2 power starting from far right and moving toward left.Ignore the far left number and ignore any padding 0\'s between the far left digit and the first 1.And the numbering sequence would be \"32,16,8,4,2,1\".
Now here 01010011
1 0 1 0 0 1 1
2^6 2^5 2^4 2^3 2^2 2^1 2^0
Now we will give numbers to only labels which have corresponding one.
64,16,2,1 and we will sum up these which is 8316
Which is 8*16+3= 131 and now check whether it started with 0 or 1, and our started with 0 so its positive hence decimal eqivalent is 131
