Popular Posts

What’s Hot

Binary Representation of Numbers

After reading this chapter, you should be able to:
1.  convert a base-10 real number to its binary representation,
2.  convert a binary number to an equivalent base-10 number.

In everyday life, we use a number system with a base of 10. For example, look at the
number 257.56. Each digit in 257.56 has a value of 0 through 9 and has a place value. It can
be written as

  

In a binary system, we have a similar system where the base is made of only two digits 0 and
1. So it is a base 2 system. A number like (1011.0011) in base-2 represents the decimal
number as




     

 in the decimal system.

To understand the binary system, we need to be able to convert binary numbers to decimal numbers and vice-versa. 

We have already seen an example of how binary numbers are converted to decimal numbers. Let us see how we can convert a decimal number to a binary number. For example take the decimal number 11.1875. First, look at the integer part: 11 

                        

Since the quotient now is 0, the process is stopped. The above steps are summarized in Table 1.

                 

For any integer, the algorithm for finding the binary equivalent is given in the flow chart on the next page.
Now let us look at the decimal part, that is, 0.1875.

1. Multiply 0.1875 by 2. This gives 0.375. The number before the decimal is 0 and the number after the decimal is 0.375. Since the number before the decimal is 0,  0 1 = − a .

2.  Multiply the number after the decimal, that is, 0.375 by 2.  This gives 0.75. The number before the decimal is 0 and the number after the decimal is 0.75. Since the number before the decimal is 0,  0 2 = − a .

3.  Multiply the number after the decimal, that is, 0.75 by 2. This gives 1.5. The number before the decimal is 1 and the number after the decimal is 0.5. Since the number before the decimal is 1,  1 3 = −a .

4.  Multiply the number after the decimal, that is, 0.5 by 2. This gives 1.0. The number before the decimal is 1 and the number after the decimal is 0. Since the number before the decimal is 1,  1 4 = −a . 

Since the number after the decimal is 0, the conversion is complete. The above steps are
summarized in Table 2.

            

                          

In the above example, when we were converting the fractional part of the number, we were left with 0 after the decimal number and used that as a place to stop. In many cases, we are never left with a 0 after the decimal number. For example, finding the binary equivalent of 0.3 is summarized in Table 3.

                

As you can see the process will never end. In this case, the number can only be approximated in binary format, that is,

            

Q: But what is the mathematics behinds this process of converting a decimal number to binary format?
A: Let z be the decimal number written as  Z = x . y

where 

x is the integer part and y is the fractional part.
We want to find the binary equivalent of x. So we can write 

        

       



















0 comments:

Post a Comment