Binary and decimal are two different number systems.
The decimal system, also known as the base-10 system, is what we use in everyday life and consists of ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The binary system, or base-2 system, consists of just two digits: 0 and 1. Computers inherently use the binary system due to their digital electronic nature.
- Converting Decimal to Binary:
Division by 2 Method
To convert a decimal number to its binary equivalent, follow these steps:
- Divide the decimal number by 2.
- Record the remainder. This will be the least significant bit (LSB).
- Use the quotient from the previous division as the new number to be divided.
- Repeat the process until the quotient becomes zero.
- The binary equivalent is the sequence of remainders read from bottom (last remainder) to top (first remainder).
Example: Convert 13 (decimal) to binary.
13 ÷ 2 = 6 remainder 1 <- LSB
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1 <- MSB
Reading from the MSB to the LSB, 13 in decimal is equivalent to 1101 in binary.
- Converting Binary to Decimal:
To convert a binary number to its decimal equivalent, follow these steps:
Positional Weight Method:
- Write down the binary number and assign a positional weight to each bit, starting from the rightmost bit (LSB) as 2^0 and increasing by one power of 2 for each position to the left.
- Multiply each bit by its positional weight.
- Sum the results of these multiplications.
Example: Convert 1101 (binary) to decimal.
(1 × 2^3) + (1 × 2^2) + (0 × 2^1) + (1 × 2^0)
= 8 + 4 + 0 + 1
= 13
Thus, 1101 in binary is equivalent to 13 in decimal.
Understanding the conversion between binary and decimal systems is fundamental in computer science, as it bridges the gap between human-readable numbers and the binary language of computers. Mastery of these conversions equips one with the foundational knowledge required for various computer operations and algorithms.
Converting a binary number to its decimal equivalent is fairly straightforward. Simply add the powers of 2
corresponding to the positions of the 1s in the binary number. For your reference, here are the first 8 powers of 2.