---
# System prepended metadata

title: 'HOW COMPUTERS STORE NEGATIVE NUMBERS USING  (- 11 as a case study) '

---


**How computers store negative numbers (using -11 as a case study):**

The computer is able to process data and performs tasks based on a set of instructions called a program . A program is a set of instructions written in a language that the computer understands and executes in order to solve an exact problem , computer programming can further more be defined as solving problems.
Just like humans speak and understands different dialects mostly depending on what part of the world we’re from , the computer also has a language it understands , this language is known as binary or machine language ( 0 & 1s) . The computer has other programming languages which differ transcending the five generations of computers and have evolved consecutively with technology overtime . They all individually brought major changes in hardware , software and how data ( negative numbers inclusive ) can be stored and processed .
Programming languages a divided into two ; namely high and low level languages , we humans are more familiar with the high level languages while the computer is more inclined to the low level languages but communication became simplified with the help of translators . 
Symbolizing positive numbers in binary is straight-forward , on the other hand illustrating negative numbers is a bit more complicated because they can’t be stored directly , hence the use of special binary methods . 
 Special binary methods :
1* Sign and Magnitude : the leftmost bit ( most significant ) carries the sign .
  0 = Positive
  1 = Negative
The remaining bits store the number e. g 6 bits
 +6 = 000011
  -6 = 101011
The problem with this method is that it has two representations for 0 : 0000 and 1000 , this makes the arithmetic challenging.
2* One’s complement : this transposes all bits of the positive number to get the negative version . 
  e. g 8 bits :
  +8 = 00001111
   -8 = 11110000
The problem with this method is that it also has two representations for 0 : 0000 and 1111 .
3* Two’s complement ( most commonly used method today ) : this transposes the bits similar to One’s complement , then add 1
  e. g 8 bits : 
  +8 = 00001111
   -8 = 11110000 ( transpose)
  Add 1 ; 11110001 = -8
It is the most commonly used method today because : 
* Only one 0 = 0000
* It makes arithmetic less challenging
* It is supported by all modern CPU’s.

Converting -11 to its 8 bit binary using two’s complement binary representation :
Step 1; from negative it automatically transposes to positive ( similar to one’s law )
 so -11 becomes +11
Step 2 ; find the binary of  +11 using 8 bits
11 in binary = 00001011
Step 3 ; transpose bits ( one’s complement ) = 11110100
Step 4 ; add 1 to the transposed bits ( to get to two’s complement ) I .e 11110100 + 1  = 11110101
-11 in 8 bit two’s complement binary is 11110101.
 
Corresponding hexadecimal value :
divide in two
1111  0101
1111 = ( 1 x 23 ) + (1x 2 2) + ( 1 x 21 ) + (1 x 20) 
         =    8  +  4  +  2  +  1
Answer is 15.
0101 = ( 0 x 2<sup>3</sup> ) + ( 1 x 2<sup>2 </sup>) + ( 0 x 2<sup>1</sup>) + ( 1 x 2<sup>0</sup>) 
         =   0 + 4  +  0  +  1
Answer is 5.
In Hex 15 = F

Final answer is `0x5F`.
    
   