1,830 views
2 2 votes
in 8 bit representation max +ve value is +127  which is understandable as 01111111 but max - ve value is -128 how it can be stored     as left most bit will always be 1 and rest 7 bits can only store 111111 i.e max of 127 so how -128 is stored

2 Answers

Best answer
4 4 votes
Computer generally uses $2's$ complement representation for storing numbers. So $+127$ is stored as $\color{red}{01111111}$ with MSB i.e. $8^{th}$ bit being $0$ indicating that it is a positive number and $-128$ is represented as $10000000$, i.e., $8^{th}$ bit indicating that number represented by this bit pattern is a negative number and magnitude is represented as $-2^7*1 + 0*2^6 + 0*2^5 + \dots + 0.2^0 = -128$

So, $-128$ is stored as $\color{red}{10000000}$
• selected by
1 1 vote

-128 = 10000000

1's complement of 10000000  is,  01111111

2'complement is,  01111111 + 1 = 10000000

Position:
Show:

Related questions

2 2 votes
1 answers 1 answer
2.6k
2.6k views
Meenakshi Sharma asked Oct 29, 2016
2,579 views
what is the min and max range of an 8 bit integer when it is stored ina)sign magnitude formb)1's complement formc)2's complement form
0 0 votes
1 1 answer
1.5k
1.5k views
radha gogia asked Sep 13, 2015
1,508 views
Say I declare an array likeint abc ;int arr[abc] ;printf("%d",sizeof(arr));Now this abc holds some garbage value so then how come the size of the array is negative value ...
2 2 votes
0 0 answers
5.0k
5.0k views
worst_engineer asked Jul 18, 2016
4,950 views
Here is the question :Find out the maximum sub-array of non negative numbers from an array.The sub-array should be continuous. That is, a sub-array created by choosing th...
1 1 vote
1 1 answer
1.4k
1.4k views
MiNiPanda asked Feb 2, 2018
1,382 views
I have this doubt that if the maximum value of x is to be found so that it is included in MST, then will it be 3 or 4? Because if it is 3 then there is no doubt that it w...