Negative Numbers Are Computationally Positive

Computers are unable to store negative numbers, because there is no "-" in binary. As such, they resort to various algorithms to indicate that a number is negative instead.

A computer has the following negative numbers stored in binary form using the 2's complement approach. Which number is wrongly stored?

-37 as 1101 1011 -89 as 1010 0111 -48 as 1110 1000 -32 as 1110 0000

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

7 solutions

Discussions for this problem are now closed

Vishal Barot
May 15, 2014

first to convert 48 decimal to binary form which is 00110000 hear -48 is given so that find complement1 's of -48 .11001111+1= 11010000

Gaurav Pathak
May 22, 2014

A simple and useful technique to find the 2's complement of the number is: F i r s t r e p r e s e n t t h e n u m b e r i n B i n a r y f o r m . T h e n s t a r t f r o m l e f t a n d c o p y d o w n t h e d i g i t s s a m e a s a b o v e u n t i l y o u e n c o u n t e r a 1... O n c e y o u e n c o u n t e r a o n e i n v e r t a l l t h e r e m a i n i n g n u m b e r s i . e c h a n g e 0 t o 1 a n d 1 t o 0 e g : l e t x = 89 i n b i n a r y f o r m 89 = 01011001 N o w s t a r t i n g f r o m l e f t I e n c o u n t e r 1 i n p o s i t i o n 0 s o I c o p y i t d o w n a n d c h a n g e a l l t h e r e m a i n i n g 1 s t o 0 s a n d 0 s t o 1 s t o g e t 10100111 , w h i c h i s i n f a c t t h e 2 s c o m p l e m e n t o f 89 S i m i l a r l y f o r 48 = 00110000 2 s c o m p l e m e n t = 11010000. h e n c e 48 i s t h e a n s w e r . First\quad represent\quad the\quad number\quad in\quad Binary\quad form.\\ Then\quad start\quad from\quad left\quad and\quad copy\quad down\quad the\quad digits\quad same\quad as\quad above\quad until\quad you\quad \\ encounter\quad a\quad 1...Once\quad you\quad encounter\quad a\quad one\quad invert\quad all\quad the\quad remaining\quad numbers\quad i.e\quad change\quad \\ 0\quad to\quad 1\quad and\quad 1\quad to\quad 0\\ eg:\quad let\quad x\quad =\quad 89\quad \\ in\quad binary\quad form\quad 89\quad =\quad 01011001\\ Now\quad starting\quad from\quad left\quad I\quad encounter\quad 1\quad in\quad position\quad '0'\quad so\quad I\quad copy\quad it\quad down\quad and\quad change\quad all\\ the\quad remaining\quad 1's\quad to\quad 0's\quad and\quad 0's\quad to\quad 1's\quad to\quad get\quad \\ 10100111,\quad which\quad is\quad infact\quad the\quad 2's\quad complement\quad of\quad 89\\ Similarly\quad for\quad 48\quad =\quad 00110000\\ 2's\quad complement\quad =\quad 11010000.\\ hence\quad 48\quad is\quad the\quad answer. .

Theodore Kokkoris
May 21, 2014

48 -> (convert to binary) 00110000 -> (flip all bits) 11001111 -> (add 1) 11010000 != 11101000

only the choice which is -48 has the wrong answer.. because -48 in binary form is 1011 0000 and using 2's complement approach -48 is 1011 0000 which is contradictory to the given choice (1110 1000).

Zuhanee Khan
May 29, 2014
  1. Convert the DECIMAL number (without sign) to its BINARY form.
  2. Replace each digit by its complement (1 to 0; 0 to 1. Zeros can be added to the left to make the number of digits as a multiple of 4).
  3. Add 1 with the number obtained after step 2
Abhimanyu Kaushal
May 24, 2014

Its simple!!!! 1. Convert the decimal number to the binary form.(consider no negative sign) 2. now take the compliment of each number. (if the no. is 1 then compliment should be 0 and vice-a-verse). 3. Add 1 to the no. complimented.(if last digit is 1 than 1+1=0). 4. Now, the number formed is the same decimal no. but with a negative sign.

Soubhik Sanyal
May 24, 2014

-48 is wrongly stored. The correct for -48 stored in 2's complement form will be 11010000

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...