Conversion between two Number systems:


Conversion between two Number systems:
Decimal-to-binary Conversion
Now to convert a number in decimal to a number in binary we have to divide the decimal number by 2 repeatedly, until the quotient of zero is obtained. This method of repeated division by 2 is called the ‘double-dabble’ method. The remainders are noted down for each of the division steps. Then the column of the remainder is read in reverse order i.e., from bottom to top order.

Short division by two with remainder

This method is much easier to understand when visualized on paper. It relies only on division by two.
  1. 1
    For this example, let's convert the decimal number 15610 to binary. Write the decimal number as the dividend inside an upside-down "long division" symbol. Write the base of the destination system (in our case, "2" for binary) as the divisor outside the curve of the division symbol.
    2)156
  2. 2
    Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the dividend.
    2)156   0
       78
  3. 3
    Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 0.
    2)156   0
     2)78   0
     2)39   1
     2)19   1
      2)9   1
      2)4   0
      2)2   0
      2)1   1
        0
  4. 4
    Starting with the bottom remainder, read the sequence of remainders upwards to the top. You should have 10011100. This is the binary equivalent of the decimal number 156. Or, written with base subscripts: 15610 = 100111002

Example


We will find the binary equivalent of (13.375)10.
Solution:

  • The integer part = 13
Divisor
Dividend
Remainder
2
13
-----
2
6
1
2
3
0
2
1
1
-----
0
1



  • The binary equivalent of (13)10 is therefore (1101)2
  • The fractional part = .375
  • 0.375 × 2 = 0.75 with a carry of 0
  • 0.75 × 2 = 0.5 with a carry of 1
  • 0.5 × 2 = 0 with a carry of 1
  • The binary equivalent of (0.375)10 = (.011)2
  • Therefore, the binary equivalent of (13.375)10 = (1101.011)2


Binary to Decimal Conversion
Since the binary system is the internal language of electronic computers, serious computer programmers should understand how to convert from binary to decimal. 

Positional notation method

  1. 1
    For this example, let's convert the binary number 110112 to decimal. List the powers of two from right to left. Start at 20, evaluating it as "1". Increment the exponent by one for each power. Stop when the amount of elements in the list is equal to the amount of digits in the binary number. The example number, 10011011, has eight digits, so the list, to eight elements, would look like this: 128, 64, 32, 16, 8, 4, 2, 12
  2. Write first the binary number below the list.
    Here is this step written on paper using the example binary number, 10011011.
    Here is this step written on paper using the example binary number, 10011011.
  3. 3
    Draw lines, starting from the right, connecting each consecutive digit of the binary number to the power of two that is next in the list above it. Begin by drawing a line from the first digit of the binary number to the first power of two in the list above it. Then, draw a line from the second digit of the binary number to the second power of two in the list. Continue connecting each digit with its corresponding power of two.
    Here is this step written on paper using the example binary number, 10011011.
    Here is this step written on paper using the example binary number, 10011011.
  4. 4
    Move through each digit of the binary number. If the digit is a 1, write its corresponding power of two below the line, under the digit. If the digit is a 0, write a 0 below the line, under the digit.
    Here is this step written on paper using the example binary number, 10011011.
    Here is this step written on paper using the example binary number, 10011011.
  5. 5
    Add the numbers written below the line. The sum should be 155. This is the decimal equivalent of the binary number 10011011. Or, written with base subscripts: 100110112 = 15510

    Here is this step written on paper using the example binary number, 10011011.  The sum of the bottom row, 155, is its decimal equivalent.  Or, written with base subscripts:  100110112 = 15510
    Here is this step written on paper using the example binary number, 10011011. The sum of the bottom row, 155, is its decimal equivalent. Or, written with base subscripts: 100110112 = 15510

Example:

The decimal equivalent of the binary number (1001.0101)2 is determined as follows:
  • The integer part = 1001
  • The decimal equivalent = 1 × 20 + 0 × 21 + 0 × 22 + 1 × 23 = 1 + 0 + 0 + 8 = 9
  • The fractional part = .0101
  • Therefore, the decimal equivalent = 0 × 2−1 + 1 × 2−2 + 0 × 2−3 + 1 × 2−4 = 0 + 0.25 + 0 + 0.0625 = 0.3125
  • Therefore, the decimal equivalent of (1001.0101)= 9.3125
  1. Number System Conversion Calculator


1 comments:

  1. Unknown said...

    Have you ever tried Trend Trader? No such great systems I have ever seen like Trend Trader. It is comfortably usable for all level of traders and Forex Money Managers (FMM) or Multi Account Managers (MAM). It enables FMM to handle multiple trading accounts simultaneously and allows you to observe and work with several trading accounts at the same time. Check it here right now with some demos: Trend Trader Official Website

Post a Comment