Number Systems
Number Systems
A number is a mathematical value used for counting and measuring objects, and
for performing arithmetic calculations. Numbers have various categories like
natural numbers, whole numbers, rational and irrational numbers, and so on.
Similarly, there are various types of number systems that have different
properties, like the binary number system, the octal number system, the decimal
number system, and the hexadecimal number system.
There are different types of number systems in which the four main types are:
The binary number system uses only two digits: 0 and 1. The numbers in this
system have a base of 2. Digits 0 and 1 are called bits and 8 bits together make a
byte. The data in computers is stored in terms of bits and bytes. The binary
number system does not deal with other numbers such as 2,3,4,5 and so on. For
example: 100012, 1111012, 10101012 are some examples of numbers in the
binary number system.
The octal number system uses eight digits: 0,1,2,3,4,5,6 and 7 with the base of
8. The advantage of this system is that it has lesser digits when compared to
several other systems, hence, there would be fewer computational errors. Digits
like 8 and 9 are not included in the octal number system. Just as the binary, the
octal number system is used in minicomputers but with digits from 0 to 7. For
example: 358, 238, 1418 are some examples of numbers in the octal number
system.
The decimal number system uses ten digits: 0,1,2,3,4,5,6,7,8 and 9 with the base
number as 10. The decimal number system is the system that we generally use
to represent numbers in real life. If any number is represented without a base, it
means that its base is 10. For example: 72310, 3210, 425710 are some examples of
numbers in the decimal number system.
A number can be converted from one number system to another number system.
Like binary numbers can be converted to octal numbers and vice versa, octal
numbers can be converted to decimal numbers and vice versa and so on. Let us
see the steps required in converting number systems.
Solution:
Step 1: Identify the base of the given number. Here, the base of 1001112 is 2.
Step 2: Multiply each digit of the given number, starting from the rightmost
digit, with the exponents of the base. The exponents should start with 0 and
increase by 1 every time as we move from right to left. Since the base is 2 here,
we multiply the digits of the given number by 20, 21, 22 , and so on from right to
left.
Step 3: We just simplify each of the above products and add them.
Here, the sum is the equivalent number in the decimal number system of the
given number. Or, we can use the following steps to make this process
simplified.
= 32 + 0 + 0 + 4 + 2 + 1
= 39
Solution:
Step 1: Identify the base of the required number. Since we have to convert the
given number into the octal system, the base of the required number is 8.
Step 2: Divide the given number by the base of the required number and note
down the quotient and the remainder in the quotient-remainder form. Repeat
this process (dividing the quotient again by the base) until we get the quotient
less than the base.
Step 3: The given number in the octal number system is obtained just by
reading all the remainders and the last quotient from bottom to top.
Solution:
Step 1: Convert this number to the decimal number system as explained in the
above process.
Here, we have to convert 70010 into the hexadecimal system using the above-
mentioned process. It should be noted that in the hexadecimal system, the
numbers 11 and 12 are written as B and C respectively.
Solved Example:
Solution:
27/2 13 1 0
13/2 6 1 1
6/2 3 0 2
3/2 1 1 3
1/2 0 1 4
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011
10 1010 20 10100
It is easy to remember the table and answer the Decimal number’s
equivalent Binary number. When the given decimal number is huge
then we will have to convert it to binary number with the step-by-step
procedure explained below.
37 ÷ 2 18 1
18 ÷ 2 9 0
9÷2 4 1
4÷2 2 0
2÷2 1 0
1÷2 0 1
Q2. What is the Binary Number of 32?
Answer: 32’s Binary Equivalent number is (100000) 2 .
1st Step: 32 ÷ 2 = Q(16) R(0)
2nd Step: 16 ÷ 2 = Q(8) R (0)
3rd Step: 8 ÷ 2 = Q(4) R (0)
4th Step: 4 ÷ 2 = Q(2) R (0)
5th Step: 2 ÷ 2 = Q(1) R (0)
6th Step: 1 ÷ 2 = Q(0) R (1)
32 ÷ 2 16 0
16 ÷ 2 8 0
8÷2 4 0
4÷2 2 0
2÷2 1 0
1÷2 0 1
Q2. How do you write 14 in Binary?
Answer: 14’s binary Equivalent number is (1110) 2 .
1st Step: 14 ÷ 2 = Q(7) R(0)
2nd Step: 7 ÷ 2 = Q(3) R (1)
3rd Step: 3 ÷ 2 = Q(1) R (1)
6th Step: 1 ÷ 2 = Q(0) R (1)
14 ÷ 2 7 0
7÷2 3 1
3÷2 1 1
1÷2 0 1
Convert Decimal Fraction to Binary
There is a simple method to find the equivalent binary representation
of a decimal fractional number. The steps to convert Decimal
Fraction to Binary Number are given number:
0.5 X 2 1.0 1 0
Since we are just finding the fractional part, the integer part will
remain the same.
In most cases, the fractional part will never become zero; hence the
number can be represented only approximately – what results out of
the approximation is called round-off error
Binary of 0.125
Step 1
----------
0.125 x 2 = 0.250
Integer part = 0
----------
0.250 x 2 = 0.500
Integer part = 0
Step 3
----------
0.500 x 2 = 1.000
Integer part = 1
Fractional part = 0
Step 1
----------------
Dividend = 10
Divisor = 2
Quotient = 5
2 ) 10 ( 5
10
----
Step 2
----------------
Dividend = 5
Divisor = 2
Quotient = 2
2)5(2
4
----
Step 3
----------------
Dividend = 2
Divisor = 2
Quotient = 1
2)2(1
----
Step 4
-----------------
Dividend = 1
As, dividend is less than 2 so, we will stop here and copy the dividend as the
last remainder.
Binary of 0.16
Step 1
----------
Integer part = 0
Step 2
----------
0.32 x 2 = 0.64
Integer part = 0
Step 3
----------
0.64 x 2 = 1.28
Integer part = 1
Step 4
----------
0.28 x 2 = 0.56
Integer part = 0
Step 5
----------
0.56 x 2 = 1.12
Integer part = 1
Step 6
----------
We multiply 0.12 by 2 and take the integer part
0.12 x 2 ...
in this case, we have 5 digits as answer and the fractional part is still not 0 so,
we stop here.
Binary Decimal
0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15
10000 16
10001 17
10010 18
10011 19
10100 20
Solution:
In the binary to decimal conversion shown below, we start from the right and
move towards the left.
Therefore, (11001011)2(11001011)2 = (203)10(203)10
Solution:
Step 1: Write the binary number and start from the left-most digit.
Take the doubled value of the previous digit and add it with the current
digit. Since in the binary number 101011012101011012, '1' is the left-
most digit and there is no previous number, the doubled value is 0. Now,
adding it with the current value which is 1, we get (0 × 2) + 1, which is 1.
Step 2: Follow the same step as described in step 1 for all the
numbers as you move on to the right.
Step 3: Finally, the sum that is achieved in the last step is the
decimal equivalent of the binary value.
The steps that were discussed above for the binary to decimal conversion are
shown below:
Solution:
To convert decimal to octal number, there are two methods of conversions. The
first method is to convert the decimal number to another number system i.e.
binary or hexadecimal and finally convert it to octal. The second method is the
direct method where we convert decimal to octal directly. Let see both the
methods:
Step 2: Once we have obtained the binary number, we can convert this number
to an octal number by using the binary to the octal conversion table.
With the help of the above table, we first write the number into its 3-bit binary
number as a zero needs to be added before digits to form the 3-bit binary
number. Hence, the 3-bit binary number is 101 and 101. Looking at the same
table above we can convert these binary numbers to their octal numbers to
derive the final number. Hence, the numbers are 5 and 5.
Therefore, (101101)2(101101)2 = (55)8(55)8.
Step 3: Once we have obtained the octal number, the conversion from decimal
to octal can be written as: (45)10(45)10 = (55)8(55)8.
Step 1: Check if the decimal number is less than 8. If yes, the octal number is
the same. If no, then proceed forward. In this case, 350 is more than 8 so let's go
to step 2.
Step 2: Divide 350 by 8 (octal base number). Note down the quotient and the
remainder in the quotient-remainder form. Repeat this process (dividing the
quotient again by 8) until we get the quotient to be less than 8.
Step 3: Once we obtain the quotient to be less than 8 we stop dividing to derive
at the octal number. The octal number is considered by reading all the
remainders and the last quotient from bottom to top.
Therefore, (350)10(350)10 = (536)8(536)8.
Step 1: Separate the decimal number into two parts - the integer and the
fractional. So, 29.45 = 29 + 0.45.
Step 2: Convert the integer part of the number first. So, we begin with 29 first
by dividing it by the base number 8 until the quotient is less than 8.
29/8 3 5
3/8 0 3
Step 3: Once the integer octal number is obtained, we proceed to the fractional
part. So, 0.45 is multiplied by 8 (octal base number) where the result is again
divided into its integer part and fractional part. The number is multiplied by 8
until the fractional part is equal to zero.
Write all the integer part from top to bottom that derives the octal number of the
fractional number. Hence, 0.45 = 0.3463146.
Step 4: Add both the integer and the fractional part together to obtain the octal
number. Hence, 35 + 0.3463146 = 35.3463146.
Therefore, (29.45)10(29.45)10 = (35.3463146)8(35.3463146)8.
Octal to Decimal
Steps to Convert Octal to Decimal
As with any other conversion in the number system, octal to decimal conversion
is also done by using its base number. To convert octal to decimal, we need to
multiply the octal digits with the power of 8 starting from the right-hand side
and gradually decreasing to zero to sum up, all the products. Here are the steps
to convert a number from octal to decimal:
Step 1: Write 140 with the power of 8. Start from the right-hand side.
1 × 82 + 4 × 81 + 0 × 80
Step 3: Multiply each of the power of 8 numbers with the respective numbers.
1 × 64 + 4 × 8 + 0 × 1 = 64 + 32 + 0
64 + 32 + 0 = 96.
Therefore, (140)8(140)8 = (96)10(96)10.
Convert Octal to Decimal With Decimal Point
To convert octal to decimal number with a decimal point, we need to follow the same
procedure as did in the previous section. However, the power or the exponents of 8 will vary
after the decimal point. Since we are moving towards the right-hand side with
the exponents increasing, the exponents after the decimal point will decrease or be negative.
Let us look at an example.
Step 1: Write 140 with the power of 8. Start from the right-hand side. Here, the power of 8
will be negative after the decimal point.
Step 3: Multiply each of the power of 8 numbers with the respective numbers.
Therefore, (246.28)8(246.28)8 = (166.375)10(166.375)10.
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. You can convert using direct
methods or indirect methods. First, you need to convert a binary into other base
system (e.g., into decimal, or into hexadecimal). Then you need to convert it
octal number.
Most Significant Bit (MSB) Octal Point Least Significant Bit (LSB)
Since number numbers are type of positional number system. That means
weight of the positions from right to left are as 8 0, 81, 82, 83 and so onfor 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.
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.
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
So, if you 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,
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.
540 / 16 = 33 12 = C
33 / 16 = 2 1
2 / 16 = 0 2
0 / 16 = 0 0
Now, write remainder from bottom to up (in reverse order), this will be 021C
(or only 21C) which is equivalent hexadecimal number of decimal integer 540.
But above method can not convert fraction part of a mixed (a number with
integer and fraction part) hexadecimal number. For decimal fractional part, the
method is explained as following below.
(b) Converting with Remainders (For fractional part)
Let decimal fractional part is M then multiply this number from 16 because base
of hexadecimal number system is 16. Note down the value of integer part,
which will be − 0 to 15 (replace 10, 11, 12, 13, 14, 15 by A, B, C, D, E, F
respectively). Again multiply remaining decimal fractional number till it
became 0 and note every integer part of result of every step. Then write noted
results of integer part, which will be equivalent fraction hexadecimal number of
given decimal number. This is procedure for converting an fractional
decimal number, algorithm is given below.
Take decimal number as multiplicand.
Multiple this number by 16 (16 is base of hexadecimal so multiplier
here).
Store the value of integer part of result in an array (it will be: 0 to 15,
because of multiplier 16, replace 10, 11, 12, 13, 14, 15 by A, B, C, D, E,
F respectively).
Repeat the above two steps until the number became zero.
Print the array (which will be equivalent fractional hexadecimal number
of given decimal fractional number).
Note that a multiplicand (here decimal fractional number) is that to be
multiplied by multiplier (here base of hexadecimal, i.e., 16)
Example − Convert decimal fractional number 0.06640625 into hexadecimal
number.
Since given number is decimal fractional number, so by using above algorithm
performing short multiplication by 16 with integer part.
0.06640625 x 16=1.0625 1
0.0625 x 16 =1.0 1
Multiplication Resultant integer part
0 x 16=0.0 0
Now, write these resultant integer part, this will be approximate 0.110 which is
equivalent hexadecimal fractional number of decimal fractional 0.06640625.
Converting with Division
This method is guessing hexadecimal number of a decimal number. You need to
draw a table of power of 16, For integer part, The algorithm is explained as
following below.
Start with any decimal number.
List the powers of 16.
Divide the decimal number by the largest power of 16.
Find the remainder.
Divide the remainder by the next power of 16.
Repeat until you've found the full answer.
Example − Convert decimal number 380 into hexadecimal number.
According to above algorithm, table of power of 16,
Hexadecimal Digit 0 1 7 C
= (1x27+1x26+1x25+1x24+0x23+0x22+0x21+1x20)10 or (3x82+6x81+1x80)10
= (241)10
However, there is a simple direct method to convert a hexadecimal number to
decimal number. Since, there are only 16 digits (from 0 to 7 and A to F) in
hexadecimal number system, so we can represent any digit of hexadecimal
number system using only 4 bit as following below.
Hexa 0 1 2 3 4 5 6 7
Binary 0000 0001 0010 0011 0100 0101 0110 0111
Most Significant Bit (MSB) Hexa Point Least Significant Bit (LSB)
Since number numbers are type of positional number system. That means
weight of the positions from right to left are as 16 0, 161, 162, 163and so on. for
the integer part and weight of the positions from left to right are as 16 -1, 16-2, 16-
3
and so on. for the fractional part.
You can directly convert a hexadecimal number into decimal number using
reverse method of decimal to hexadecimal number.
Assume any unsigned hexadecimal number is hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm.
Then the decimal number is equal to the sum of hexadecimal digits (hn) times
their power of 16 (16n), i.e.,
= hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm
= hnx16n+h(n-1)x16(n-1)+ ... +h1x161+h0x160+h-1x16-1+h-2x16-2+ ... +h(m-1)x16-(m-1)+h-
-m
mx16
This is simple algorithm where you have to multiply positional value of binary
with their digit and get the sum of these steps.
Example-1 − Convert hexadecimal number ABCDEF into decimal number.
Since value of Symbols − A, B, C, D, E, F are 10, 11, 12, 13, 14, 15
respectively. Therefore equivalent decimal number is,
= (ABCDEF)16
= (10x165+11x164+12x163+13x162+14x161+15x160)10
= (10485760+720896+49152+3328+224+15)10
= (11259375)10 which is answer.
Example-2 − Convert hexadecimal number 1F.01B into decimal number.
Since value of Symbols: B and F are 11 and 15 respectively. Therefore
equivalent decimal number is,
= (1F.01B)16
= (1x161+15x160 +0x16-1+1x16-2+11x16-3)10
= (31.0065918)10 which is answer.
Conversion from Binary to Hexadecimal number system
Hexadecimal 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 hexadecimal number. You can convert using
direct methods or indirect methods. First, you need to convert a binary into
other base system (e.g., into decimal, or into octal). Then you need to convert it
hexadecimal number.
Most Significant Bit (MSB) Hexa Point Least Significant Bit (LSB)
Since number numbers are type of positional number system. That means
weight of the positions from right to left are as 16 0, 161, 162, 163and so on. for
the integer part and weight of the positions from left to right are as 16 -1, 16-2, 16-
3
and so on. for the fractional part.
Example − Convert binary number 1101010 into hexadecimal number.
First convert this into decimal number:
= (1101010)2
= 1x26+1x25+0x24+1x23+0x22+1x21+0x20
= 64+32+0+8+0+2+0
= (106)10
Then, convert it into hexadecimal number
= (106)10
= 6x161+10x160
= (6A)16 which is answer.
However, there is also a direct method to convert a binary number into
hexadecimal number − grouping which is explained as following below.
Using Grouping
Since, there are only 16 digits (from 0 to 7 and A to F) in hexadecimal number
system, so we can represent any digit of hexadecimal number system using only
4 bit as following below.
Hexa 0 1 2 3 4 5 6 7
Hexa 8 9 A B C D E F
So, if you make each group of 4 bit of binary input number, then replace each
group of binary number from its equivalent hexadecimal digits. That will be
hexadecimal number of given 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 4 bit, this does not change value of input binary number.
So, these are following steps to convert a binary number into hexadecimal
number.
Take binary number
Divide the binary digits into groups of four (starting from right) for
integer part and start from left for fraction part.
Convert each group of four binary digits to one hexadecimal digit.
This is simple algorithm where you have to grouped binary number and replace
their equivalent hexadecimal digit.
Example-1 − Convert binary number 1010101101001 into hexadecimal
number. Since there is no binary point here and no fractional part. So,
Step 1:
4 F A
4 15 10
Step 2:
4 F A
4 15 10
8421 8421 8421
Step 3:
4 F A
4 5 10
8421 8421 8421
(Notice the bold digits sum up to the hex value above. So the bold digits are 1
and the others are 0.)
Step 4:
4 F A
4 15 10
8421 8421 8421
0100 1111 1010
Hexadecima
Octal Equivalent Decimal Equivalent BInary
l
0 0 0 0
1 1 1 1
2 2 2 10
3 3 3 11
4 4 4 100
5 5 5 101
6 6 6 110
7 7 7 111
8 10 8 1000
9 11 9 1001
A 12 10 1010
B 13 11 1011
C 14 12 1100
D 15 13 1101
E 16 14 1110
F 17 15 1111
Solved Examples
Question 1: What is the equivalent form of F216?
Solution
F216 = ( F × 161 ) + ( 2 × 160 )
= F × 16 + 2 × 1
= 17 × 16 + 2
= 272 + 2
F216 = 272 (Decimal form)
272
8
34 ---- 0
8
4 ---- 2
8
4 ---- 4