Representation of Fractions in Binary

binary

Representation of Fractions in Binary

 

FIXED·POINT REPRESENTATION

Fractions can be written in binary by extending the binary notation explained for integers above.

In a binary number the digits after the point represent 1/2, 1/4, 18/, etc.

Worked question

Give the decimal equivalents of the binary numbers

(a) 110.11 (b) 0.001

(a) 1102 =610

  0.112 =1/2+1/4=0.5+0.25

=0.75

110.112=6.7510

(b) 0.0012 = 1/ 8

=0.12510

A fixed-point number is one which is represented by a set of digits with the point in its correct position.

e.g. 313.45 is a fixed-point decimal number;

1101.1101 is a fixed-point binary number.

FLOATING-POINT REPRESENTATION

The mantissa of a number consists of the actual digits in it. The point is put at some fixed position (often in front of the first digit).

e.g. The mantissa of 34.234 is .34234

The exponent of a number gives the position of the binary or decimal point.

e.g. If the position is measured from the left of the number, the exponent of 34.234 is 2.

A floating-point number is one which is represented by writing the mantissa and the exponent.

Examples of floating-point representation

1- The decimal number 672.4 could be written as .6724 E3.

E is for exponent. The 3 indicates three significant figures to the left of the decimal point.

2- The binary number 110.1101 could be stored with an eight-bit mantissa and a four-bit exponent as 01101101 0011.

Here 01101101 is the mantissa. The first bit is a sign bit. It has been assumed that the point is just after the sign bit. The mantissa represents 0.1101101.

The number 110.1101 has three significant figures to the left of the point. Therefore the exponent is three. Expressed as a four-bit binary number, this is 001l.

Advantages of floating-point representation

Very large numbers or very small fractions can be stored using quite a small number of bits.

Disadvantage of floating-point representation

Numbers are not stored very precisely by this method. If a number has a lot of digits some of them may be lost. The mantissa can only be allowed a certain number of bits for storage. It is therefore only correct to a certain number of significant figures.

Labels: