Number System Conversion: Decimal To Binary
Number System Conversion: Decimal To Binary
As you know decimal, binary, octal and hexadecimal number systems are positional
value number systems. To convert binary, octal and hexadecimal to decimal number,
we just need to add the product of each digit with its positional value. Here we are
going to learn other conversion among these number systems.
Decimal to Binary
Decimal numbers can be converted to binary by repeated division of the number by 2
while recording the remainder. Let’s take an example to see how this happens.
The remainders are to be read from bottom to top to obtain the binary equivalent.
4310 = 1010112
Decimal to Octal
Decimal numbers can be converted to octal by repeated division of the number by 8
while recording the remainder. Let’s take an example to see how this happens.
101100101012 = 26258
To convert an octal number to binary, each octal digit is converted to its 3-bit binary
equivalent according to this table.
Octal Digit 0 1 2 3 4 5 6 7
Binary Equivalent 000 001 010 011 100 101 110 111
546738 = 1011001101110112
Binary to Hexadecimal
To convert a binary number to hexadecimal number, these steps are followed −
Starting from the least significant bit, make groups of four bits.
If there are one or two bits less in making the groups, 0s can be added after the
most significant bit.
Convert each group into its equivalent octal number.
Let’s take an example to understand this.
101101101012 = DB516
To convert an octal number to binary, each octal digit is converted to its 3-bit binary
equivalent.
Arithmetic of Number Systems
A number system is a set of symbols used to represent values derived from a common
base or radix. In a number, the value of each digit can be determined using digit,
position of the digit in the number, and the base of the number system. The base is
defined as the total number of digits are available in the number system. This is known
as positional number system.
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Arithmetic operations like addition, subtraction, multiplication and division are performed
in various radix bases. These arithmetic operations may also use r’s complement and
(r-1)’s complement representation.
These representation techniques hold basic laws for various arithmetic operations:
(i) Unique Existence Law: The sum and product of any two numbers exist uniquely.
Where 0 is the identity element for additions and 1 is the identity element for
multiplication.
(ii) Associative Law:Addition and multiplication of binary numbers are associative.
(iii) Commutative Law:Addition and multiplication of binary numbers are commutative.
(iv) Distributive Law:Multiplication of binary numbers is distributive over two or more
terms in addition.
Now, arithmetic operations for various number systems are explained as following
below.
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
There are four rules for binary subtraction. These are given as following below,
0 0 0 0
0 1 0 1
1 0 1 0
1 1 0 0
Borrow 1 is required from next higher order bit to subtract 1 from 0. So, result became
0.
There are four rules for binary multiplication. These are given as following below,
0 0 0
0 1 0
1 0 0
1 1 1
There are four part in any division: Dividend, Divisor, quotient, and remainder. These
are given as following rules for binary division,
0 0 Not defined
0 1 0
1 0 Not defined
1 1 1
+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16
With the help of above table, we can perform additions of octal numbers.
Similarly, we can perform subtraction of octal numbers same as decimal number
subtractions. But you can only take borrow of a number 7, which is maximum digit
allowed in octal number systems.
In the multiplication of octal numbers, if the product is less than radix of octal (i.e, 8),
then we take it as the result, else divide it by radix of octal (i.e., 8) and take the
remainder as the LSB (least significant bit). The quotient is taken as carry in the next
significant digit.
Similarly, division of octal numbers can be performed by following the rules of division
of decimal numbers but maximum allowed digit will be 7.
Arithmetic Operations of Hexadecimal Numbers:
It has base of 16 digits ranging from 0 to F (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and A, B, C,
D, E, F). A, B, C, D, E, F are equivalent single digits of 10, 11, 12, 13, 14, 15
respectively. Generally, it is expressed by subscript 16 or Hexa (H) or (h).
Arithmetic operations of hexadecimal numbers can be performed using addition table
for hexadecimal numbers which is given as below:
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 2 3 4 5 6 7 8 9 A B C D E F 10
2 2 3 4 5 6 7 8 9 A B C D E F 10 11
3 3 4 5 6 7 8 9 A B C D E F 10 11 12
4 4 5 6 7 8 9 A B C D E F 10 11 12 13
5 5 7 7 8 9 A B C D E F 10 11 12 13 14
6 6 7 8 9 A B C D E F 10 11 12 13 14 15
7 7 8 9 A B C D E F 10 11 12 13 14 15 16
8 8 9 A B C D E F 10 11 12 13 14 15 16 17
9 9 A B C D E F 10 11 12 13 14 15 16 17 18
A A B C D E F 10 11 12 13 14 15 16 17 18 19
B B C D E F 10 11 12 13 14 15 16 17 18 19 1A
C C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B
D D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C
E E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D
F F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E
With the help of above table, we can perform additions of hexadecimal numbers.
Subtraction of hexadecimal numbers can be performed by using complement methods
or simple as decimal subtractions. The rule of simple hexadecimal subtraction is the
digit borrowed from the immediate higher place is counted as 16.
In the multiplication of hexadecimal numbers, if the product is less than radix of
hexadecimal (i.e, 16), then we take it as the result, else divide it by radix of hexadecimal
(i.e., 16) and take the remainder as the LSB (least significant bit). The quotient is taken
as carry in the next significant digit. Using these rules, you can make a table for
hexadecimal multiplications.
Similarly, division of hexadecimal numbers can be performed by following the rules of
division of decimal numbers but maximum allowed digit will be F(=15 in decimal).