Friday 11 December 2020

Computer Number Systems: Binary - Octal - Hexadecimal

 

Number Systems:

 

Non Positional Number Systems:

 

Number systems are of two types - non positional and positional. In early days, human beings counted on fingers. When counting behind 10 fingers, they used stones, pebbles, or sticks to indicate values. This method of counting used as an additive approach or non-positional number system. In this system, we have symbols I for 1, II for 2, III for 3, etc. Each symbol represents the same value regardless of its position in a number.

 

 

Positional Number Systems:

 

In a positional number system, there are only a few symbols called digits. These symbols represent different values, depending on the position they occupy in a number. The value of each digit in such a number is determined by three considerations:

 

  1. The digit itself.
  2. The position of the digit in the number, and
  3. The base of the number system (where base is defined as the total number of digits available in the number system).

 

In our day to day life, we use decimal number system. In this system, base is equal to 10 because there are altogether 10 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9).

 

For example a decimal number 2586 (written as 258610) consists of digit 6 in unit’s position, 8 in tens position, 5 in hundreds position and 2 in thousands position; and its value can be written as:

 

(2x103) + (5x102) + (8x101) + (6x100) = 2000 + 500 + 80 + 6 = 2586

 

The principles that apply to decimal number system, also apply to any other positional number system. It is important to keep track of only the base of the number system in which we are working.

 

The value of the base in all positional number system suggests the following characteristics:

 

  1. The value of the base determines the total number of different symbols or digits available in the number system. The first of these choices is always zero.
  2. The maximum value of a single digit is always equal to one less than the value of the base.

 

 

Binary Number System:

 

Binary number system is like a decimal number system, except that the base is 2, instead of 10. We can use only 2 symbols or digits (0 and 1) in this number system. Note that the largest single digit is 1. Each position in a binary number represents a power of the base 2.

 

For example, decimal equivalent of binary number 10101(written as 101012) is:

 

(1x24)+ (0x23) + (1x22) + (0x21) + (1x20) = 16 + 0 + 4 + 0 + 1 = 21

 

In order to be specific about which system we are referring to, it is a common practice to indicate the base as a subscript.

 

Hence, we write 101012= 2110

 

The short form of binary digit is bit. Hence, a bit in computer terminology means either 0 or 1. An ‘n’ bit number is a binary number consisting of ‘n’ bits. Any decimal number in the range of 0 to 2n-1 can be represented in binary form as ‘n’ bit number.

 

Binary

Decimal equivalent

000

0

001

1

010

2

011

3

100

4

101

5

110

6

111

7

 

Figure: 3 bit numbers with their decimal values.

Every computer stores numbers, letters, and other special characters in binary form. There are several occasions when computer professionals need to know the raw data contained in a computer's memory. A commonly used way of doing this is to print memory contents on a printer. This printout is called a memory dump.

 

 

Octal Number System:

 

In octal number system, the base is 8. Hence, there are only eight symbols or digits: 0, 1, 2, 3, 4, 5, 6, and 7 (8 and 9 do not exist in this system). The largest single digit is 7. Each position in an octal number represents a power of the base 8. Therefore, decimal equivalent of octal number 2057(written as 20578) is:

 

(2x83)+ (0x82) + (5x81) + (7x80) = 1024 + 0 + 40 + 7 = 1071

 

Hence, 20578= 107110

 

Hexadecimal Number System:

 

In hexadecimal number system, the base is 16. Hence, there are 16 symbols or digits. The first 10 digits are the same digits of decimal number system - 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The remaining six digits are denoted by the symbols A, B, C, D, E and F, representing decimal values 10, 11, 12, 13, 14, 15 respectively. Hence, the largest single digit is F or 15. Each position in hexadecimal number system represents a power of the base 16. Therefore, decimal equivalent of hexadecimal number 1AF (written as 1AF16) is:

 

(1x162) + (Ax161) + (Fx160) = (1x256) + (10x16) + (15x1) = 256 + 160 + 15 = 431

 

Hence, 1AF16 = 43110

No comments:

Post a Comment