Computer Arithmetic: Floating Point Arithmetic

For representation of floating point numbers  the convenient notation of a mantissa (number) and exponent (scaling factor) are used. For example 35,000,000 may be written as 0.35x108, where 0.35 is the mantissa and 8 is the value value of exponent. Similarly 0.000025 may be written as 0.25x10-4. The number representation is based on the relation:

                     y = a x rp

Where 'y' is the number to be represented, 'a' is the mantissa, 'r' is the radix (base) of the number system (r = 10 for decimal and r = 2 for binary) and 'p' is the power to which the base is raised.

There are many formats of floating point number, each computer has its own. The format for one typical computer is shown below :

The mantissa is in 2's compliment form, left most bit can, therefore be thought of as the sign bit. the binary point is assumed to be at the right side of the sign bit. The three bits of the exponent could represent 0 through 7. However, to express negative exponents, the number 4 (in decimal) (100)2, has been added to the desired exponent. This is a common system used in floating point formats. It represents excess - 4 notation. The Exponent bits for their corresponding exponent values with base of two is shown in the below table :

To calculate the exponent value from exponent bit substract 4 (100) from the exponent bit, since it uses excess - 4 notation. For example lets see the exponent bit for 2-4, which is (000) :

Similarly take the example for 22, which exponent bits are (110) :

Now lets look at some example of 8 bit floating point numbers.

Example : 10011111

The most significant bit is 1, which represents that the numbers is negative.

The number is :

                    = -0.0011 x 23
                    = (-1.1)2

Next Topic :

No comments:

Post a Comment