How to Convert from Decimal to Binary Shortly & Efficiently?

The decimal (base ten) numeral system has ten possible values (0,1,2,3,4,5,6,7,8, or 9) for each place-value. In contrast, the binary (base two) numeral system has two possible values, often represented as 0 or 1, for each place-value.

Several ways are there to convert from decimal to binary. Our goal is to do it shortly and efficiently. Lots of techniques are available to do. Here, we will discuss the quick method to do it efficiently and hopefully for all (both for students and network engineers) it may be helpful.

SunRemember, to convert decimal to binary, we use two type of number systems:

  • Decimal number system:
      • base ten
      • possible values (0,1,2,3,4,5,6,7,8, or 9)
  • Binary number system:
      • base two
      • possible values (0 or 1)

Before doing this, first we need to remember the following table. Each IP has 4 octets and each octet has only 8 bits. One such octet is presented below and marked with each bit (8bits of a octet) by small blue rectangles. The right-most bit is the most least significant bit and the left-most bit is the most significant bit.

On the top of each blue square rectangle the no of bit position of that is depicted with dark ash boxes. There we see, the bits are started from 0 and ends with bit 7.

Below the square blue rectangles, the weighted value of those bits are presented for each bit position.

Weighted-Value-of-Binary-Bits

The above table is the base of any conversion of decimal to binary. So, remember it for all type of conversion.

Pointing upEach bit of the small square rectangle either contains 1 or 0

Pointing upIf 1 is there then the weighted value is there otherwise 0.

Methods to convert from decimal to binary:

Step 1: Start with the table of weighted value of binary bits.

Step 2: Take the decimal value and find which is immediate bigger weighted value with that value and choose the value just before of that weighted value.

Step 3: Subtract the chosen value with the decimal value

Step 4: Repeat step 2 and step 3 until  you get the subtracted value equal to zero (0).

Step 5: At last, put 0 to each of the blank bits

Examples to convert from decimal to binary:

No comments:

Post a Comment