The Gateway to Computer Science Excellence
0 votes

In the question given below:-

If i consider first bit as sign bit.. we can store my number in rest 7 bits. so in that case 127 is the largest number that can be stored. so why -127 isnt the answer?
in Digital Logic by Active (2.5k points) | 53 views

1 Answer

+1 vote
Range will tell you which all number can be represented using the limited number of bits.
Range of 2's complement number with n bits is $-2^{n-1}$ to $2^{n-1}-1$ so the smallest number possible using 8 bits is $-2^{7}=-128$

So if we can represent -128 using 8 bits which is even smaller than -127 (as asked in the question) so -128 has to be the answer.
by Active (3.3k points)
edited by
Can you justify your answer more briefly? Moreover what is the necessity of taking range under consideration here?
Check now.

@ Vikas Verma Can you help me out with this doubt?

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,378 answers
105,313 users