Friday, 31 May 2013

Floating point representation

Floating point describes the method of representing a real number in a way that it supports a wide range of values in a few significant number so that less amount of memory allocation is used by the computer. The numbers are generally represented in fixed form of significant digits (the mantissa) and is scaled using the exponent and the base is of 2 when the number is binary converted.

significand × baseexponent

152853.5047= 1.528535047 × 10Here if we compare the above generalized equation with the number, we can easily see the significant digits (significand), base (since here the digit is in the form of ten decimal digits of precision so base 10 is used) and exponent.
The location of radix point is indicated by placing explicit characters (dot or comma). If radix point is not specified it is assumed that it would lie at extreme end or at the end of the digit. We need not to store the radix point nor the base in the memory. Storing of significand (with sign) and exponent is only done in memory.




The mantissa is stored using the sign magnitude method where as exponent is stored using excess-N method in the same memory location.




In the above diagram for 32 bit of RAM 30-31 bits (1 bit) is set for the sign bit, 23-30 bits (8 bits) are set for the exponent (in that also 1 bit is assigned to the sign bit of the exponent) ,expressed in excess-127 representation, and 0-22 bits (23 bits) are reserved for the magnitude or fraction or mantissa. Below is an example of a single precision number.




Similar is the case below, for 64 bits of RAM, 1 bit reserved for sign bit, 11 bits for exponent (expressed in excess-1023 format) and rest 52 bits for mantissa.




Over the years, a variety of floating-point representations have been used in computers. However, since the 1990s, the most commonly encountered representation is that defined by the IEEE 754 Floating point Standard.





No comments:

Post a Comment