Search

Conversion exercise in decimal and binary systems, part 2: fractions

In part 1 of these exercises, we treated whole numbers or integers. This second series will deal with fractions.


Fractions are divisions of numbers, as distinct from whole numbers. 2/3 is a fraction as well as 0.342. Most times, fractions are written as the latter, with a decimal place because it is more intuitive.

converting binary fractions to decimals:

Let us take a binary fraction like 0.1001 base 2 as recurring example. Note that the decimal point makes that number a fraction. The place values of binary fractions are determined starting from the decimal point and we count starting from negative 1 (-1). That is, the first digit after the decimal point has a place value of 2 raised to minus 1 or 2-1. The second digit has a place value of 2-2, the third a place value of 2-3 and so on and so forth accordingly.


Therefore, to convert 0.10012 using the expanded notation to base 10:

0.1001 = 1 x 2 + 0 x 2 + 0 x 2 + 1 x 2 
= 1/2 + 0 +0 + 1/16

Then make all the denominators the same

= 8/16+ 1/16
            = 9/16
            = 0.562510  

Alternatively, you could convert the fractions to decimals and then sum up the decimals although that route might take a long1er time.


Another way is this:

  1. Place the decimal point to a position at the end of the last digit. It is now an integer
  2. Count the number of places you moved the decimal point and denote it as n.
  3. Convert the integer to decimal or base 10.
  4. Divide the result in (3) to 2n.
  5. Produce the decimal from the fraction.

Place the decimal point at the end: 0.1001 becomes 1001.0

Count the number of places you moved the decimal point, n: 4.

Convert the integer to decimal: 1001 base 2 is 9 base 10.

Divide the result by 2n i.e 24: 9/16

Produce the decimal equivalent of the fraction: 0.5625 base 10.


converting decimal fractions to binary


Decimals fractions can take two types, the fractions whose denominators are prime factors of 2 and those which the denominator is not. Denominators of the earlier type have terminating binary fractional equivalents while the latter have binary fractions which do not terminate and this is important when doing the conversions.


Time to stretch your legs? Credit: Wikimedia commons.

Let's take the 0.562510 decimal as an example before we try some other exercise with a fraction without a decimal point.


The technique is:

  1. Multiply the decimal fraction by 2.
  2. If the result is less than 1, place a 0 after the next decimal point else the result is greater than 1, place a 1 after the next decimal point and remove the integer part of result. If the result is equal to 1, place a 1 after the next decimal point; you have reached the termination point for the binary fraction.
  3. If (2) has not terminated, go back to (1).

Decimal to binary fraction. Terminating.
Fraction Result
0.5625 0.
0.5625 x 2 = 1.125 > 1 0.1

The result of multiplying the fraction by 2 is greater than 1, so I added a 1 to the next decimal place after the decimal point. The binary fraction, (or the result) is not going to terminate. So, let's continue. But first, I will take away the integer from the fraction.


0.125 x 2 = 0.25 < 1 0.10
0.25 x 2 = 0.5 < 1 0.100
0.5 x 2 = **1.0 = 1** 0.1001

By repeating the steps above, we arrived at a doubled fraction which is equal to 1. The binary fraction has terminated to arrive at 0.10012 as the result. It's simple, right?


Binary fractions that do not terminate are fractions whose denominators are not prime factors of 2. A denominator is the number under the dividing line in a fraction. Let us say in 2/3 the numerator is 2 and the denominator is 3. Converting this decimal fraction to binary will not terminate, though you might end the manipulation when you get a repeating pattern. Let us take 2/3 as an example.


A decimal fraction producing non-terminating binary fraction.
Fraction Result
2/3 0.
2/3 x 2 = 4/3 = 11/3 > 1 0.1

The initial multiplication by 2 results in a number greater than 1. We place a 1 after the next decimal point, remove the integer in the fraction and continue.


1/3 x 2 = 2/3 < 1 0.10
2/3 x 2 = 4/3 = 11/3 > 1 0.101
1/3 x 2 = 2/3 < 1 0.1010

Note that the last row of the table is a repeat of an earlier row. The result is a repeating pattern: 0.101010... Binary to decimal system conversions and vice versa are fun. I find myself doing them sometimes even while listening to music. You can do the same. Gottfried Leibniz wrote an article about 300
years ago
on the usefulness of binary arithmetic. You will find the discussion on chinese figures of fuxi interesting.

conversion exercise in decimal and binary systems, part 1 :whole numbers


follow me on twitter, @emeka_david or be a friend on facebook, nnaemeka david

5 comments:

  1. Hello! I am excited to find out one thing, of course if I'm not asking too much could you please share with us your place of birth?

    ReplyDelete
  2. I am Nigerian. I was born in Nigeria, in Abia State. I wonder why it is important to conversion exercises, freedomofthinking?

    ReplyDelete
  3. I’ve used profit maximizer before individually. But it does not seem to be a profitable program to me. A friend of mine he is also an expert trader. He suggested me Trend Trader. I am using this product since 3 weeks and i am getting good profit. Trend Trader always provide me right time signal to buy or sell. It's a great program for newbie trader. Also there is good option for trading. You can check it by visiting Trend Trader official site Trend Trader Official Website

    ReplyDelete
  4. It is a good site post without fail. Not too many people would actually, the way you just did. I am impressed that there is so much information about this subject that has been uncovered and you’ve defeated yourself this time, with so much quality. Good Works! BinaryToday

    ReplyDelete
  5. I would like to say that this blog really convinced me to do it! Thanks, very good post. recover lost bitcoins

    ReplyDelete

Your comments here!

Matched content