1.1.1.1 Number systems

Number System

(Already covered in F.Y.)

Sample Example from our school days

1234=1000 + 200 + 30 + 4
        =1*1000 + 2 * 100 + 3 * 10 + 4 * 1
        =1 * 10^3 + 2 * 10 ^2 + 3 * 10^1 + 4 * 10^0

Why 10 is so important ? Why we are not skipping 10 with its power anywhere ? Why only 10 ?
The answer is we are using DECIMAL number system. it has 10 symbols 0 to 9, hence 10 is so important.
There are other number systems also like binary, octal , hexadecimal.


Binary
  1. Binary has 2 symbols (0 and 1). 
  2. Any binary number will be composed of only 0 and 1. If you see other symbols in binary number then it is either mistake or its not a binary number.
  3. Like 10 in Decimal System, We will use 2 in binary number system to interpret the number
  4. 101 in binary = 1*2^2 + 0*2^1 +1*2^0
Octal
  1. Has 8 symbols (0 to 7). 
  2. Any binary number will be composed of 0,1,2,3,4,5,6,7 (Not 8). If you see other symbols in Octal number then it is either mistake or its not an Octal number.
  3. Like 10 in Decimal System, We will use 8 in Octal number system to interpret the number
  4. 742 in binary = 7*8^2 + 4*8^1 +2*8^0
Hexadecimal
  1. Has 16 symbols (0 to 9 and A=10,B=11,C=12,D=13,E=14,F=15). 
  2. Any Hexadecimal number will be composed of above symbols. 
  3. Like 10 in Decimal System, We will use 16 in Hexadecimal number system to interpret the number
  4. 7BA in binary = 7*16^2 + 11*16^1 +10*16^0

Specifying Number system
We use decimal number system so we don't specify it. But in Computer Science using number without specifying number system is confusing for the reader. 
Ex. 10 , it can be binary, octal ,decimal or hexadecimal
Ex. 12 , it can be octal, decimal or hexadecimal
Ex. 18 , it can be decimal or hexadecimal

To avoid such confusions we need to Specify number system as a subscript 
2/b/B for Binary
8/o/O for Octal (try to avoid use of 'o' or 'O', it looks similar to '0')
10/d/D for Decimal
16/h/H for hexadecimal 


2.3.2 Essential & Non-essential data