Largest positive integer can be represented by 8bit number in 2's comple form
Answers
Answered by
3
heya dear!!
Two complement can represent any number within the range −(2^(n-1)) to+(2^(n-1) -1) where the highest bit represents -2^(n-1) (e.g. for the 8bit 0b10000000 we get -128. Well if the highest bit produces the negative number, then the best thing to do to get the highest number in a N bit two's complement would be to set all bits that aren't negative like this 0b01111111. Here's the calculation:
-2^7 * 0 + 2^6 * 1 + 2^5 * 1 + 2^4 * 1 + 2^3 * 1 + 2^2 * 1 + 2^1 * 1 + 2^0 * 1 = 127. Notice how I multupled the 2^n by 0 or 1 depending on whether the bit was set or not (set meaning 1 or 0).
Or you can just do:
2^(8-1)- 1 = 2^7 - 1 = 127.
hope it helps!!☺
Two complement can represent any number within the range −(2^(n-1)) to+(2^(n-1) -1) where the highest bit represents -2^(n-1) (e.g. for the 8bit 0b10000000 we get -128. Well if the highest bit produces the negative number, then the best thing to do to get the highest number in a N bit two's complement would be to set all bits that aren't negative like this 0b01111111. Here's the calculation:
-2^7 * 0 + 2^6 * 1 + 2^5 * 1 + 2^4 * 1 + 2^3 * 1 + 2^2 * 1 + 2^1 * 1 + 2^0 * 1 = 127. Notice how I multupled the 2^n by 0 or 1 depending on whether the bit was set or not (set meaning 1 or 0).
Or you can just do:
2^(8-1)- 1 = 2^7 - 1 = 127.
hope it helps!!☺
Similar questions
English,
7 months ago
Social Sciences,
7 months ago
Math,
1 year ago
Science,
1 year ago
Math,
1 year ago