Numbers are everywhere and used in many places – financial institution, statistics, engineering and so on. Without number system our daily life would be difficult.
Humans use a number system called the decimal number system and everyone can easily understand this system. You go to a store to buy something, you need a number system to count your money. Even a small thing such as making a list of its need numbers.
What is a number system?
A number belong to a number system with
- A base ‘r’
- Coefficient ‘a’ that is between 0 to r-1.
Examples Decimal with r=10 and coefficient a = 0 to 9 Binary with r=2 and coefficient a = 0 and 1 Octal with r= 8 and coefficient a = 0 to 7 Hexadecimal with r=16 and coefficient a = 0 to 9, A, B, C, D, E, F
Converting from any number system to decimal system
If the base ‘r’ and coefficients are given then any number can be converted to decimal system using following
To convert binary number 1101 into decimal number, do following
1011 = 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 2^0 = 8 + 0 + 2 + 1 = 11
11 is decimal equivalent of 1101.
Convert 1101.0112 into decimal equivalent.
Integer part -> 1101 1 * 2^3 + 1 * 2^2 + 0 * 2^1 + 1 * 2^0 8 + 4 + 0 + 1 13 Decimal part -> .011 0 * 2^-1 + 1 * 2^-2 + 1 * 2^-3 0 + 1/4 + 1/8 3/8 Answer = 13 + 3/8 = (13 * 8 + 3)/8 = 107/8 = 13.37
Conversions from Decimal to Other Number Systems
The decimal number system have a base r = 10 and coefficients ranging from 0 –to- 9.
Decimal to Binary
To convert from decimal from binary, divide the decimal number repeatedly until no longer possible to divide. Each time you get a quotient and remainder, divide the quotient and note the remainder. The remainders of this division put together in reverse order is the answer. See the example below.
For fractional part you need to multiply the decimal fraction with base r repeatedly until you reach 0 or close to zero for the fractional part. When you multiply a fraction with base r, you get two thing – an integer and a fraction.
If the fraction has not reached zero or real close to zero, multiply it with base in next iteration and check the integer and fraction part. The integer part put together is the binary equivalent for the decimal fraction. See the example below
Convert 25.13 to binary equivalent number.
25/2 quotient = 12, remainder = 1 2/2 quotient = 6, remainder = 0 6/2 quotient = 3, remainder = 0 3/2 quotient = 1, remainder = 1 1/2 quotient = 0, remainder = 1 Now we find the fractional part binary equivalent. 0.13 * 2 = 0.26 => 0 + .26 0.26 * 2 = 0.52 => 0 + .52 0.52 * 2 = 1.04 => 1 + .04 Answer: - 11001 + .001 = 11001.001
Decimal to Octal
The decimal to octal conversion is done in the same way as decimal to binary except the base r = 8. For example
Convert 235 to its octal equivalent.
235/8 quotient = 29, remainder = 3 29/8 quotient = 3, remainder = 5 3/8 quotient = 0, remainder = 3 Answer: - 353
Decimal to Hexadecimal
The hexadecimal number has a base r = 16 and we need to divide decimal number with base r to get the hexadecimal equivalent, but hexadecimal digits 10 – 15 are A – F.
2344/16 quotient = 146, remainder = 8 146/16 quotient = 9, remainder = 2 2/16 quotient = 0, remainder = 2 Answer: The hexadecimal equivalent of 2344 is 822.
Conversions to Binary
Octal to Binary
To convert octal to binary, convert each digit of octal number to its binary equivalent, but you are only allowed to use 3 bit positions because 111 = 7 which is the maximum range of octal coefficient. For example
Convert 256 into its binary equivalent.
2 -> 0 1 0 5 -> 1 0 1 6 -> 1 1 0 Answer: The binary equivalent is 010 101 110.
Hexadecimal to Binary
We use 4 bits to convert each digit in a hexadecimal number to get the binary equivalent. This is because 1111 = 15 = F in decimal, the maximal value allowed in hexadecimal number. For example
Convert 2CD3 into binary equivalent.
2 C D 3 0010 1100 1101 0011
The binary equivalent of 2CD3 is 0010 1100 1101 0011.
Binary to Other Number Systems
Binary to Octal
To convert from binary to octal use 3 bit position and convert it into its decimal equivalent.
- For integer part 3 bit from left to right
- For fractional part 3 bit from right to left
This will give you the octal equivalent of binary number. For example,
1001.0101 => 001 110 . 010 100 1 6 . 2 1 Answer: - The octal equivalent is 16.21.
Binary to Hexadecimal
Group the given binary number into group of four and then convert the each of the group into decimal equivalent to get the hexadecimal digit and group all the digits found to get the hexadecimal number. For example
Convert the given binary number 110101011100 into hexadecimal equivalent.
Given binary number can be separated into group of four. 110101011100 => 1101 0101 1100 13 5 12 D 5 C Therefore, the hexadecimal equivalent number is D5C.
Other Number Systems
Octal to hexadecimal
We use a very simple procedure to convert octal to hexadecimal number. You can do this two easy steps.
- Convert Octal to Binary number.
- Convert the Binary number obtained into hexadecimal.
In the previous section, we learned about converting octal to binary and binary into hexadecimal. In this section, you have to use that knowledge in converting octal to hexadecimal. For example,
Convert the given octal number 234 into Hexadecimal equivalent.
Step1: Convert the octal into binary number. 2 3 4 010 011 100 Step2: Convert the binary number into hexadecimal number. 010011100 Group the binary number into groups of four bits from left to right. 0000 1001 1100 0 9 12 Convert the result into hexadecimal number. Therefore, the hexadecimal equivalent is 09C.
Hexadecimal to Octal
If you reverse the process given in octal to hexadecimal conversion, you will get an octal equivalent for hexadecimal number.
John.F.Wakerly. 2008. Digital Design: Principles And Practices, 4/E. Pearson Education, India.
Mano, M. Morris. 1984. Digital Design. Pearson.
NATARAJAN, ANANDA. 2015. Digital Design. PHI Learning Pvt. Ltd.