|
Fixed point numbering system is an alternative method of representing real numbers. It has two main advantages over floating point. The first is that it is much faster on machines which do not have a floating point co-processor such as the GP2X. The second is that it has slightly better determinism with respect to addition, subtraction and integers. Its main disadvantage is that it is limited in range, where as floating point has a much greater range.
Fixed point works by getting a regular integer data type and reserving a part of the bitspace for the integer part of the number, and the other part of the bitspace for the fractional part of the number. Generally the data is 32-bits in size, as this is the common size of 'int' especially on 32-bit CPUs such as in the GP2X. People may split this up by using 16 bits for the integer part and 16 bits for the fractional part, which is written 16.16. They may desire mostly fractional accuracy and use 2.30, or perhaps they don't care too much about the fraction part and might use 24.8.
To explain I will use 16.16 as it is the most common. |