Decimal to binary conversion for fractional numbers



There is a simple method to find the equivalent binary representation of a decimal fractional number.

Let us look at an example [pic]

• Multiply 0.59375 by 2, and the result is 1.1875. The integer part is 1, and the fractional part is 0.1875.

• Now take the fractional part 0.1875, multiply it by 2 and the result is 0.375. The integer part is 0, and the fractional part is 0.375.

• Continue the above procedure until the fractional part is 0. (In most cases, the fractional part will never become zero; hence the number can be represented only approximately – what results out of the approximation is called round-off error).

The values of the integer and fractional parts are listed in the table below.

| |Result |Integer Part |Fractional part |

|0.59375*2 |1.1875 |1 |0.1875 |

|0.1875*2 |0.375 |0 |0.375 |

|0.375*2 |0.75 |0 |0.75 |

|0.75*2 |1.5 |1 |0.5 |

|0.5 |1.0 |1 |0 |

The binary representation therefore is the collection of the integer parts starting from the first one.

[pic]

If this approach is used to introduce the decimal to binary conversion of fractional numbers in the classroom, the students may blindly learn the method but not necessarily the reason behind it. A better way to show the method through example (other than symbolically) is as follows.

Ask what is the smallest positive integer m for which 2-m can be subtracted from 0.59735 to leave a positive remainder. Well it is m=1, so that

[pic]

Now take the remaining fractional part, which is 0.09375 in this case and ask the same question. What is the smallest positive integer m, such that 2-m can be subtracted from 0.09375 to leave a positive remainder? Well it is m=4, so that

[pic]0.03125

and hence

[pic]

Now take the remaining fractional part, which is 0.03125 now and ask the same question. What is the smallest integer m>0, such that 2-m can be subtracted from 0.03125 to leave a positive remainder? Well it is m=5, so that

[pic]

and hence

[pic]

There is no more remaining fractional part left now.

Rewriting 0.59375 in terms of all negative powers of 2 starting from the highest power, we get

[pic]

The binary representation therefore is the collection of the coefficients of the powers of 2, that is,

[pic]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download