We mention here various conversion methods like binary to decimal, hexadecimal to decimal, hexadecimal to binary conversion are provided below in detail:
Table of Contents
Binary to decimal conversion
A binary number can be expressed as the sum of the product of each of these digit and the digit’s place value.
For example,
110101 = 1 x 2⁵ + 1 x 2⁴ + 0 x 2³ + 1 x 2² + 0 x 2¹ + 1 x 2⁰
110.101 = 1 x 2² + 0 x 2¹ + 1x 2⁰ + 1 x 2⁻¹ + 1 x 2⁻² + 0 x 2⁻³
Since each power of two it weighted by either 0 or 1, and the binary number is the sum of the place values in which the bit 1 appears. This sum gives the decimal equivalent of the binary number.
The table lists the binary representations of the integers from 0 to 20, with the place value of the bits shown at the top.
Example: Covert a) 10101 and b) 101.110 to decimal.
Ans: a) To convert 101012 to its decimal equivalent, write the appropriate place value over each bit and then and up those powers of two which are weighted by 1:
b) To convert 101.110₂ to its decimal equivalent, use the decimal values of the powers of two
Binary to Decimal
Decimal to binary conversion
It is possible to find a binary representation of a decimal number N by converting its integral part (NF ) separately.
Example: Covert 109.78125 to binary number
Ans: a) to convert the integral part N1, that is 109, to binary, divide N1 and each successive quotient by 2, nothing the remainders, as follows:
The zero quotients indicate the end of the divisions. The sequence of remainders from the bottom to up, as indicated by the arrow, yields the required binary equivalent. That is, N1 = 109= 11011012.
In practice, the above divisions may be shown as:
Here the division processes are stopped when the quotient, 1, is less than the divisor 2. Again the arrow indicates the sequence of bits that give the binary equivalent of the number.
b) To convert, the fractional part NF, that is 0.78125, to its binary equivalent, multiply NF and each successive fractional part by 2, noting an integral part of the product, as follows:
The zero fractional part indicates the end of the multiplications. It is observed that the integral part of any product can only be 0 or 1. The sequence of integral parts as
As indicated by the arrow, yields the required binary number.
That is, NF,=0.78125=0.110012
In practice, the above multiplications may be shown as:
It is observed that the integral part of each product is underlined and is not used in the next multiplication. Again the arrow indicates the sequence of digits that give the required binary representation.
The binary equivalent of N is simply the sum of the binary equivalents of integral and fractional parts.
N= N1 + NF = 1101101.11001
Example: Convert 13.6875 to decimal
Remark: the binary equivalent of a decimal fraction does not always terminate. For example, for the decimal number 0.6.
This shows that the above four steps will be repeated again and again. That is,
Decimal 0.6= 0.1001 1001 1001… …
Hexadecimal to decimal conversion
Conversion between the hexadecimal and decimal systems is accomplished using the algorithms of section 2.3 with b=16. Additionally one has to know how to handle the hexadecimal digits A, B, C, D, E, and F.
One can also convert from hexadecimal to decimal by decimal by decimal evaluation of the expanded hexadecimal form.
Example: covert 73D516 to its decimal equivalent.
Example: covert 39.B816 to its decimal equivalent.
Example: convert the decimal number 9719 to its hexadecimal equivalent.
The base of a hexadecimal number is 16. Divide the number and each successive quotient by 16, noting the remainders, as follows:
Here the sequence of remainders, with F for reminder 15, in reverse order gives the hexadecimal form the decimal number.
Example: Convert the decimal fraction 0.78125 to its hexadecimal equivalent.
For this conversion apply the integral-part algorithm, with base 16, as follows:
In this case, a zero fractional part is reached. The sequence of integral parts, with C for 12 gives the required hexadecimal form.
Example: convert the decimal number 9719.78125 to its hexadecimal form.
From the prevision example we know, 971910 = 251710 and. 7812510 = C816
Combining the two parts, 9717.7812510=25F7.C816
Hexadecimal to binary conversion
This is accomplished exactly as octal-binary conversion, except that 4-bit equivalents are now involved.
Example: convert to binary form a) 3D5916, b) 27.A3C16.
Replacing each hexadecimal digit by its 4-bit representation
a) 3D 5916 = 0011 1101 0101 1001
That is, 3D 5916 = 111101010110012
b) Similarly, 27.A3C16 = 0010 0111.1010 0011 1100
That is 27. A3C16 =100111.10100011112
Example: convert the binary numbers
a) 101101001011102,
b) 11100.10110110112
To hexadecimal forms.
Partitioning each binary number into 4-bit blocks to the left and right of the fractional points and then replacing each 4-bit block with its equivalent hexadecimal digit,
a) Binary 0010 1101 0010 1110 Hexadecimal 2D2E
That is, 2d2E16 is the required hexadecimal form.
b) Similarly, 0001 1100.1011 0110 11002 = 1C.B6C16
Hence, 1C.B6C16 is the required hexadecimal form.
Hope you find all conversion methods including binary to decimal.
You may like also:
- Conversion Table – Decimal, Binary, Octal, Hexadecimal
- What is Alphanumeric Code with List
- ASCII Code Symbols List
- Computer Abbreviations and Acronyms
- Process of Numeric Data Representation in the Computer
Great post. I was checking constantly this blog and I am impressed!
Extremely useful info specially the last part 🙂 I care for such info a lot.
I was looking for this particular information for a long time.
Thank you and good luck.
You’r most Welcome… 🙂