Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Number System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Basics of Computers - Number System

What is a Number?
A number is a mathematical value used for counting or measuring or labelling objects. Numbers are
used to performing arithmetic calculations. Examples of numbers are natural numbers, whole
numbers, rational and irrational numbers, etc. 0 is also a number that represents a null value.
Number Systems in Computer
The language we use to communicate with each other is comprised of words and characters. We
understand numbers, characters and words. But this type of data is not suitable for computers.
Computers only understand the numbers.
So, when we enter data, the data is converted into electronic pulse. Each pulse is identified as code
and the code is converted into numeric format by ASCII. It gives each number, character and symbol a
numeric value (number) that a computer understands. So to understand the language of computers,
one must be familiar with the number systems.
The Number Systems used in computers are:
o Binary number system
o Octal number system
o Decimal number system
o Hexadecimal number system

Binary number system


It has only two digits '0' and '1' so its base is 2. In this number system, there are only two types of
electronic pulses; absence of electronic pulse which represents '0'and presence of electronic pulse
which represents '1'. Each digit is called a bit. A group of four bits (1101) is called a nibble and group
of eight bits (11001010) is called a byte. The position of each digit in a binary number represents a
specific power of the base (2) of the number system.

The binary number system is very useful in electronic devices and computer systems because it can
be easily performed using just two states ON and OFF i.e. 0 and 1.

Octal number system


It has eight digits (0, 1, 2, 3, 4, 5, 6, 7) so its base is 8. Each digit in an octal number represents a
specific power of its base (8). As there are only eight digits, three bits (2 3=8) of binary number system
can convert any octal number into binary number. This number system is also used to shorten long
binary numbers. The three binary digits can be represented with a single octal digit.

Decimal number system


This number system has ten digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) so its base is 10. In this number system,
the maximum value of a digit is 9 and the minimum value of a digit is 0. The position of each digit in
decimal number represents a specific power of the base (10) of the number system. This number
system is widely used in our day to day life. It can represent any numeric value.

Hexadecimal number system


This number system has 16 digits that ranges from 0 to 9 and A to F. So, its base is 16. The A to F
alphabets represent 10 to 15 decimal numbers. The position of each digit in a hexadecimal number
represents a specific power of base (16) of the number system. As there are only sixteen digits, four
bits (24=16) of binary number system can convert any hexadecimal number into binary number. It is
also known as alphanumeric number system as it uses both numeric digits and alphabets.
CONVERSION
1) Binary to Decimal Conversion
Convert Binary to Decimal
We just have to follow the below steps to convert binary numbers to their decimal equivalent.
Step 1: Write the binary number and count the powers of 2 from right to left (starting from 0).
Step 2: Write each binary digit(right to left) with corresponding powers of 2 from right to left,
such that first binary digit will be multiplied by the greatest power of 2.
Step 3: Add all the products in the step 2
Step 4: The answer is our decimal number.
This can be better explained using the below examples.
Binary to Decimal Conversion
Binary to Decimal conversion is achieved using the two steps that are,
 Positional Notation Method
 Doubling Method
Now let’s learn about them in detail.
Method 1: Using Positions
Binary to Decimal Conversion can be achieved using the example added below.
Example 1: Let’s consider a binary number 1111. We need to convert this binary number to a
decimal number.
As mentioned in the above paragraph while converting from binary to decimal we need to
consider each digit in binary number from right to left.

Note: We represent any binary number with this format (xxxx)2 and decimal in (xxxx)10 format.
Example 2: Convert (101010)2 = (?)10

We keep on increasing the power of 2 as long as number of digits in binary number increases.
Example 3: Convert (11100)2 = (?)10

Resultant Decimal number = 0+0+4+8+16 = 28


So (11100)2 = (28)10
Method 2: Doubling Method
To explain this method we will consider an example and try to solve that stepwise.
Example 1: Convert Binary number (10001)2 to decimal.
Similar to the above approach, In this approach also consider each digit but from left to right
and performs step-wise computations on it.

1 0 0 0 1

Step-1 First we need to multiply 0 with 2 and add the 1st digit in binary number.
0x2+1=0+1=1
Step-2 Now use the result of above step and multiply with 2 and add the second digit of binary
number.
1 0 0 0 1

1x2+0=2+0=2
The same step 2 is repeated until there will be no digit left. The final result will be the resultant
decimal number.
1 0 0 0 1

2x2+0=4+0=4
1 0 0 0 1

4x2+0=8+0=8
1 0 0 0 1

8 x 2 + 1 = 16 + 1 = 17
So we performed step 2 on all remaining numbers and finally, we left with result 17 which is a
decimal number for the given binary number.
So (10001)2 = (17)10
Example 2: Convert (111)2 to decimal using doubling approach.
1 1 1
0x2+1=0+1=1
1 1 1

1x2+1=2+1=3
1 1 1

3x2+1=6+1=7
The final result is 7 which is a Decimal number for 111 binary numeral system. So (111)2 = (7)10
These are the 2 approaches that can be used or applied to convert binary to decimal.
2. Decimal to Binary Conversion
For converting Decimal numbers into binary numbers, use different methods such as formula,
division methods, and so on. Here, use the remainder formula. Steps to convert decimal number to
binary number using decimal to the binary formula are as follow:
Step 1: Divide the given decimal number by 2, and find the remainder (Ri).
Step 2: Now divide the quotient (Qi) that is obtained in the above step by 2, and find the remainder.
Step 3: Repeat the above steps 1 and 2, until 0 is obtained as a quotient.
Step 4: Write down the remainder in the following manner: the last remainder is written first,
followed by the rest in the reverse order (Rn, R(n – 1) …. R1). Thus binary conversion of the given
decimal number will be obtained.
Let’s understand the above steps with the help of an example.
Example: Convert 17 to Binary Form.
Solution:
Following the above steps we will divide 17 by 2 successively. The division process is shown the
image added below:

Hence the Binary Equivalent of 17 is 10001.


Some examples of converting decimal numbers to binary are:
1. Decimal 10 to Binary
 Divide 10 by 2 to get quotient 5 and remainder 0.
 Divide 5 by 2 to get quotient 2 and remainder 1.
 Divide 2 by 2 to get quotient 1 and remainder 0.
 Divide 1 by 2 to get quotient 0 and remainder 1.
Reading the remainders in reverse order: 1010. Therefore, the binary equivalent of decimal 10 is
1010.
2. Decimal 25 to Binary
 Divide 25 by 2 to get quotient 12 and remainder 1.
 Divide 12 by 2 to get quotient 6 and remainder 0.
 Divide 6 by 2 to get quotient 3 and remainder 0.
 Divide 3 by 2 to get quotient 1 and remainder 1.
 Divide 1 by 2 to get quotient 0 and remainder 1.
Reading the remainders in reverse order: 11001. Therefore, the binary equivalent of decimal 25 is
11001.
3. Decimal 47 to Binary
 Divide 47 by 2 to get quotient 23 and remainder 1.
 Divide 23 by 2 to get quotient 11 and remainder 1.
 Divide 11 by 2 to get quotient 5 and remainder 1.
 Divide 5 by 2 to get quotient 2 and remainder 1.
 Divide 2 by 2 to get quotient 1 and remainder 0.
 Divide 1 by 2 to get quotient 0 and remainder 1.
Reading the remainders in reverse order: 101111.
What is equivalent value of (278)10 in Binary?
We have 278 in Decimal. To Convert in Binary we will divide 278 successively by 2.

Hence, (278) in decimal is equivalent to (100010110) in binary.


Qustion 2: Convert (25)10 in Binary
We have 25 in decimal. To convert 25 in binary we will divide 25 by 2 successively

Hence, the Binary Equivalent of 25 is 11001


Question 3: What is the value of 75 in Binary?
Solution:
We have 75 in decimal. To convert 75 in binary we will divide 25 by 2 successively

Hence, the Binary Equivalent of 75 is 1001011


3. Conversion from Binary to Octal number system

Octal number system provides convenient way of converting large binary numbers into more
compact and smaller groups. There are various ways to convert a binary number into octal number.
We can convert using direct methods or indirect methods. First, we need to convert a binary into
other base system (e.g., into decimal, or into hexadecimal). Then we need to convert it octal number.

Since numbers are type of positional number system. That means weight of the positions from right
to left are as 80, 81, 82, 83 and so on for the integer part and weight of the positions from left to right
are as 8-1, 8-2, 8-3and so on for the fractional part.

Example − Convert binary number 10010110 into octal number.


First convert this into decimal number
= (10010110)2
= 1x27+0x26+0x25+1x24+0x23+1x22+1x21+0x20
= 128+0+0+16+0+4+2+0
= (150)10
Then, convert it into octal number
= (150)10
= 2x82+2x81+6x80
= (226)8 which is answer.
Example − Convert binary number 10010110 into octal number.
First convert this into decimal number = (10010110)2 = 1x27+0x26+0x25+1x24+0x23+1x22+1x21+0x20 =
128+0+0+16+0+4+2+0 = (150)10 Then, convert it into octal number = (150)10 = 2x82+2x81+6x80 =
(226)8 which is answer.
However, there is also a direct method to convert a binary number into octal
number − grouping which is explained as following below.
Using Grouping
Since, there are only 8 digits (from 0 to 7) in octal number system, so we can represent any
digit of octal number system using only 3 bit as following below.
if we make each group of 3 bit of binary input number, then replace each group of binary
number from its equivalent octal digits. That will be octal number of given number number.
Note that you can add any number of 0’s in leftmost bit (or in most significant bit) for integer
part and add any number of 0’s in rightmost bit (or in least significant bit) for fraction part for
completing the group of 3 bit, this does not change value of input binary number.

So, these are following steps to convert a binary number into octal number.
 Take binary number
 Divide the binary digits into groups of three (starting from right) for integer part and
start from left for fraction part.
 Convert each group of three binary digits to one octal digit.
This is simple algorithm where you have to grouped binary number and replace their
equivalent octal digit.
Example-1 − Convert binary number 1010111100 into octal number. Since there is no binary
point here and no fractional part. So,

Therefore, Binary to octal is.

= (1010111100)2
= (001 010 111 100)2
= (1 2 7 4)8
= (1274)8

Example-2 Convert binary number 0110 011.1011 into octal number. Since there is binary point here
and fractional part. So,

Therefore, Binary to octal is.


= (0110 011.1011)2
= (0 110 011 . 101 1)2
= (110 011 . 101 100)2
= (6 3 . 5 4)8
= (63.54)8

These are above simple conversions binary number to octal number.


4. Conversion from Octal to Binary number system
There is a simple direct method to convert an octal number to binary number. Since there are
only 8 symbols (i.e., 0, 1, 2, 3, 4, 5, 6, and 7) in octal representation system and its base (i.e., 8)
is equivalent of 23=8. So, we can represent each digit of octal in group of 3 bits in binary
number.
Octal Symbol Binary equivalent

0 000

1 001

2 010

3 011

4 100

5 101

6 110

7 111
This method is simple and also works as reverse of Binary to Octal Conversion. The algorithm
is explained as following below.
 Take Octal number as input
 Convert each digit of octal into binary.
 That will be output as binary number.
Example-1 Convert octal number 540 into binary number.
According to above algorithm, equivalent binary number will be,
= (540)8
= (101 100 000)2
= (101100000)2
This is very simple conversion, you can use for mixed (integer with fractional) octal number as
well.
Example-2 − Convert octal number 352.563 into binary number.
According to above algorithm, equivalent binary number will be,
= (352.563)8
= (011 101 010 . 101 110 011)2
= (011101010.101110011)2

2nd Method
Q.1: Convert 418 to a binary number.
Solution: Given number is 418
418 = (4 * 81) + (1 * 80)
=4*8+1*1
= 32+1
= 33(Decimal number)
Now convert this decimal number into its equivalent binary number. Let us draw a table to show the
conversion of decimal to binary as given below.

Decimal Number divided by 2 Quotient Remainder

33 divided by 2 16 1

16 divided by 2 8 0

8 divided by 2 4 0

4 divided by 2 2 0

2 divided by 2 1 0

1 divided by 2 0 1

Therefore, the equivalent binary number is 1000012.


Hence, 418 = 1000012

Q.2: Convert 108 to a binary number.


Solution: Given number is 108
108 = (1 * 81) + (0 * 80)
=1*8+0*1
=8+0
= 8 (Decimal number)
Now convert this decimal number into its equivalent binary number. Let us draw a table to show the
conversion of decimal to binary as given below.
Decimal Number divided by 2 Quotient Remainder
8 divided by 2 4 0
4 divided by 2 2 0
2 divided by 2 1 0
1 divided by 2 0 1
Therefore, the equivalent binary number is 10002.
Hence, 108 = 10002
.

You might also like