Kalpana Kalpana (Editor)

Fixed float

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In computing, fixed float describes a method of representing real numbers in a way that number and decimal point value is stored at different location or bytes in a memory allocated to variable unlike floating point. In a typical 4 byte (on little endian platform) fixed float number lower(lsb) 2 bytes are used to store the decimal part of the number just like integer value. While upper 2 bytes are used to store the part of number before the decimal point. Floating point numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16. The typical number that can be represented exactly is of the form:

Contents

Significant digits × baseexponent

Overview

Above method of representing the floating point numbers is complex method of representing the floating point numbers, but with it we can represent wide range of floating points numbers by this method. As well as it is convenient to manipulate the floating point numbers by this method. It is difficult for a human being to convert floating point (real numbers in mathematical language) number into the format in which they are stored into the memory. As well as it is difficult to convert back floating point, looking its hex or binary value, into the real number. Due to the conversion problem fixed floating point numbers are used. Fixed floating point numbers could be easily converted by the human into its memory representation and from memory representation into the actual number.

Memory layout

Here is detailed memory layout of how fixed floating point number are stored in memory. Suppose we want to represent the number 23.7. In hex representation 23 is represented as 0017. While 7 is represented as 0007, so hex value stored in 4 bytes allocated for fixed float would be 0017 0007. Also if you convert back number which is represented as hex representation in memory 0023 0070. As upper two bytes have value 0023, its decimal representation is 35, while lower two bytes are 0070, which has decimal representation as 112. So the real number in decimal system is 35.112.

References

Fixed float Wikipedia