Home » Numerical Techniques Using C++ » Binary Representation of Numbers | How numbers are represented in Binary

Binary Representation of Numbers | How numbers are represented in Binary

Advertisements
Loading...

A number in Binary representation is a combination of only two digits i.e. 0 and 1. For example, consider the number 341.45 which is in decimal notation. This number can  be interpreted as

     3×102+4×101+1×100+4×101+5×102

In this case, 10 is called the base or the radix of the number system. There are 10 symbols or digits in this system namely 0, 1,2,3,…,9. Any set of symbols greater than 1 may be used as a base for a number system. The simplest such system has two symbols 0 and 1. This is the base 2 or binary system. In this system a number would be interpreted as:

 an2n + an12n1 + . . . + a0 + a121+ a222 + . . . + am2m

where (an ,an1, . . . , a0, a1 , . . . , am) can each assume a value 0 or 1. Thus, for example the number 101.011 in binary system would be interpreted as:

Advertisements
Loading...

Given the binary number the procedure above gives a technique to determine the equivalent decimal number. The reverse, namely , given a decimal number converting it to binary is also straightforward. for example given the number 14.875 in base 10 system its binary equivalent is found by determining the positive and negative powers of 2 whose sum makes up the above number. it is achieved by tackling the integer and fractional parts separately. The integral part is successively divided by 2 as shown below:

binary conversion
Advertisements
Loading...

The remainder after each division is either 0 or 1 and is noted on the right. After successive divisions when the final quotient is zero the procedure is stopped. The binary equivalent is the set of 1s and 0s obtained as remainders, the last remainder being the most significant binary digit. Thus 14=1110. The procedure explained above is really a  method of getting a polynomial equivalent of the decimal number with 2 as the base of the polynomial.

The binary equivalent of the fractional part is obtained in a similar way. In this case instead of successively dividing by 2, the division is by 1/2( or multiplication is either 1 or 0 and these bits read from top to bottom give the binary equivalent. The procedure is topped when the fractional part of the product is zero. 

example:

convert 12.375 to binary.

thus 17.375=10001.001

Advertisements
Loading...

Leave a Comment

Your email address will not be published. Required fields are marked *