The number system we use in computers is a positional number system. The positional number represents a number as a series of digits where the value of each digit depends on its position in the number. The positional number is referred to as a *weighted number system* as each digit is related to a certain *weight.*

In this section, we will study only those number systems under positional number systems which are used by the computer i.e., decimal number system, binary number system, hexadecimal, and octal number system.

## Content: Number System in Computer

### What is Positional Number System?

In a positional number system, the numbers are organized in the ordered set of digits where the value of each digit is decided by its position in the number and the base of the number system we are using.

In a positional number system, the value of each digit present in the number can be determined using the following three factors.

- The digit of which value we want to determine.
- The position of the digit in the number.
- The base or radix of the number system we are using.

The general form of any number in a positional number system is:

*(**…………….**a*_{3 }*a*_{2 }*a*_{1 }*a*_{0}*. **a*_{–}_{1 }*a*_{–}_{2 }*a*_{–}_{3}*……………**)*_{r}

Here, the *a _{i}* is a digit in the number, the value of ‘

**i**‘ represents the position of the digit in the number, and

**r**represents the radix or base of the number system it is using to represent the number.

The dot present between the digit *a** _{0}* and

*a*

_{–}*is the*

_{1}**radix**point and value of the number can determine by:

*.…. +**a*_{3 }*r ^{3} + *

*a*

_{2}*r*

^{2}+*a*

_{1}*r*

^{1}+*a*

_{0}*r*

^{0}+*a*

_{–}

_{1}*r*

^{-1}+*a*

_{–}

_{2}*r*+

^{-2}*a*

_{–}

_{3}*r*

^{-3}+…..*X *= *Σ** _{i} *(

*a*

_{i}x r

^{i})

In the section, ahead we will discuss the four most common number systems under the positional number system.

### Decimal Number System

The decimal number system is the number system that we use in our daily life routine to count and calculate certain things. There are 10 digits that we use to represent a decimal number from 0 to 9 (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9).

The base or the radix of the decimal number is 10. Let us see how do we express the decimal number 8246.

(8246)_{10} = (8 x 1000) + (2 x 100) + (4 x 10) + (6×1)

= (8 x 10^{3}) + (2x 10^{2}) + (4 x 10^{1}) + (6 x 10^{0})

As here, in decimal number system we have the radix 10 each digit present in the is multiplied by 10, and the power of 10 is decided by the position of the corresponding digit in the number.

For example, we count the position of the digits in the number 8246 then the digit 6 is at one’s place, 4 is at ten’s place, 2 is at hundred’s place and 8 is at thousand’s place.

The fractional number in the decimal system also follows the same principle the only change is that the power of 10 is negative. Consider then fractional number 0.264

(0.264)_{10} = (2 x 10^{-1}) + (6 x 10^{-2}) + (4 x 10^{-3})

The digit at the extreme left side of a number is referred to as the **most significant bit. **And the digit at the extreme right side of a number is referred to as the** least significant bit**.

In general terms the representation of decimal number is:

*X *= {……….d_{4}d_{3}d_{2}d_{1}d_{0}d_{-1}d_{-2}d_{-3}…….}_{10}

* = {…. + **d*_{3 }*10 ^{3} + *

*d*

_{2}*10*

^{2}+*d*

_{1}*10*

^{1}+*d*

_{0}*10*

^{0}+*d*

_{–}

_{1}*10*

^{-1}+*d*

_{–}

_{2}*10*+

^{-2}*d*

_{–}

_{3}*10*

^{-3}+….}_{10}*X *= *Σ** _{i} *( d

_{i}x 10

^{i})

If you can observe the representation of decimal numbers then see that weight of each position is 10 times the value of the position to its right and it is one-tenth the value of the position to its left.

### Binary Number System

In the binary number system, any number is represented using two bits or two digits that are 0 and 1. As the binary number system uses two bits to represent the number the radix or base in the binary system is 2.

Now let us see how can we represent a binary number to a decimal. Consider the binary number 101101_{2}. Here the subscript 2 is used to avoid confusion between the various number system.

In fact, the subscript 10 is used to represent the decimal number, subscript H or16 is used to represent hexadecimal numbers and subscript 8 is used to represent octal numbers. So, let’s start with the binary number 101101_{2}.

101101_{2} = (1 x 2^{5}) + (0x 2^{4}) + (1 x 2^{3}) + (1 x 2^{2}) + (0 x 2^{1}) + (1 x 2^{0})

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

101101_{2} = 45_{10}

Like in decimal, the fractional number in binary system are represented with the negative power of 2. For example, consider the binary fractional number:

101.110_{2} = (1 x 2^{2}) + (0 x 2^{1}) + (1 x 2^{0}) + (1 x 2^{-1}) + (1 x 2^{-2}) + (0 x 2^{-3})

= 4 + 0 + 1 + 0.5 + 0.25 +0

= 5.75

The binary representation of a number is:

*X *= {……….b_{4}b_{3}b_{2}b_{1}b_{0}b_{-1}b_{-2}b_{-3}…….}_{2}

* = {…. + **b*_{3 }*2 ^{3} + *

*b*

_{2}*2*

^{2}+*b*

_{1}*2*

^{1}+*b*

_{0}*2*

^{0}+*b*

_{–}

_{1}*2*

^{-1}+*b*

_{–}

_{2}*2*+

^{-2}*b*

_{–}

_{3}*2*

^{-3}+….}_{2}*X *= *Σ** _{i} *( b

_{i}x 2

^{i})

### Hexadecimal System

Although the binary number is more convenient for the computer still it is not convenient for human beings. Hence, we need a compact method to represent numbers. Though the decimal number can resolve the need for a compact number system it becomes tedious to convert binary to decimal and vise versa. This is why the hexadecimal number system came into use.

As we know the decimal number uses 10 digits (0-9) to represent a number and to represent these 10 digits we require 4 binary bits. But the problem is the 4 binary bits represent 16 combinations of which for only 10 combinations we have a decimal representation but what about the remaining 6 combinations.

So, for that, we use a hexadecimal form. You can understand this with the help of the table below:

Now you can understand how the hexadecimal number represents a compact form.

To understand the ease of this system let us see how a long string of binary bits 101010011111_{2} is easy converted to the hexadecimal form:

Note: To convert a binary number into a hexadecimal form the first group all binary bits into sets of four bits which is also referred to as a **nibble**.

1010 1001 1111

Now as we have divided the string of binary bits into three sets each having four bits. Find the corresponding symbol for each set from the table above which would be:

A9F_{16}

Converting this binary string into decimal would be tedious work but converting the long string of binary bits in hexadecimal number is faster and easier. And the hexadecimal number is even more compact than a binary number.

Now let us see how can this hexadecimal number can be converted into a decimal numbers.

A9F_{16} = (A_{16} x 16^{2}) + (9_{16} x 16^{1}) + (F_{16} x 16^{0})

= (10_{10} x 16^{2}) + (9_{10} x 16^{1}) + (15_{10} X 16^{0})

= (10 x 256) + (9 x 16) + (15 X 1)

= (2560) + (144) + (15)

### Octal System

The octal number was used frequently in the past. It uses 8 digits from 0 to 7 (0, 1, 2, 3, 4, 5, 6, 7). The radix of octal number is 8 and the general form to represent the octal number is:

*X *= {……….*o*_{4}* o*_{ 3}* o*_{ 2}* o*_{ 1}* o*_{ 0}* o*_{ -1}* o*_{ -2}* o*_{ -3}…….}_{8}

* = {…. + **o* _{3 }*8 ^{3} + *

*o*

_{2}*8*

^{2}+*o*

_{1}*8*

^{1}+*o*

_{0}*8*

^{0}+*o*

_{–}

_{1}*8*

^{-1}+*o*

_{–}

_{2}*8*+

^{-2}*o*

_{–}

_{3}*8*

^{-3}+….}_{8}*X *= *Σ** _{i} *(

*o*

_{ i}x 8

^{i})

_{8}

Consider a octal number 467_{8} and we will convert this to decimal.

467_{8} _{ }= (4 x 8^{2}) + (6 x 8^{1}) + (7 x 8^{0})

= (256) + (48) + (7)

= 311_{10}

So, these are the positional number system that is used while working with the computer. Among all of these, the hexadecimal number presents compact numbers and provides easier conversions.

## Leave a Reply