Advertisement

Overview of a Computer - Data Representation

Overview of a Computer - Data Representation

·        The first computers used vacuum tubes to hold data

·        Vacuum tubes have two states - ON and OFF

·        An ON state represents a 1

·        An OFF state represents a 0

·        Eight vacuum tubes strung together can represent an 8 digit string of 0s and 1s

·        Put another way, this string is an 8 digit binary (base 2) number

·        We use decimal (base 10) numbers in our daily life

·        A decimal number is a string of digits whose values are drawn from the set {0,1,2,3,4,5,6,7,8,9}


·        In general, a number system is simply a way of representing numbers

·        A number system has a base (the number of digits used in the number system)


·       Consider a number in a base b number system:

     
·       The value of this number is:

      


 
·        A binary number has a base of 2 where the valid digits are 0 or 1

·        E.g., 1001 binary == 9 decimal (1*8 + 0*4 + 0*2 + 1)

·        An octal number has a base of 8 where the valid digits are 0 through 7

·        E.g., 031 octal == 25 decimal (3*8 + 1)

·        A decimal number has a base of 10 where the valid digits are 0 through 9

·        E.g., 2000 decimal == 2000 

·        A hexadecimal number has a base of 16 where the valid digits are 0 through F, i.e. {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
·        E.g., xABBA hex == 43962 decimal (10*4096 + 11*256 + 11*16 + 10)


Powers of 2


2^0
1
2^11
2048         2K
2^1
2
2^12
4096         4K
2^2
4
2^13
8192         8K
2^3
8
2^14
16,384      16K
2^4
16
2^15
32,768      32K
2^5
32
2^16
65,536      64K
2^6
64
2^17
131,072    128K
2^7
128
2^18
263,144    256K
2^8
256
2^19
524,288    512K
2^9
512
2^20
1,048,576    1M
2^10
1024        1K
2^21
2,097,152    2M

1 KILO = 2^10 = 1024
1 MEG  = 2^20 = 1024*1024      = 1,048,576
1 GIGA = 2^30 = 1024*1024*1024 = 1,073,741,824

To evaluate a binary number, say 101101, simply add up the corresponding powers of 2:

101101 = 1× 25 + 0× 24 + 1× 23 + 1× 22 + 0× 21 +1× 20

= 32 + 0 + 8 + 4 + 0 + 1

= 45