Fixed Float
   HOME

TheInfoList



OR:

{{Tone, date=December 2022 In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, fixed float describes a method of representing
real number In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
s 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 computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can ...
. 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 Significant figures (also known as the significant digits, ''precision'' or ''resolution'') of a number in positional notation are digits in the number that are reliable and necessary to indicate the quantity of something. If a number expres ...
and scaled using an
exponent Exponentiation is a mathematical operation, written as , involving two numbers, the '' base'' and the ''exponent'' or ''power'' , and pronounced as " (raised) to the (power of) ". When is a positive integer, exponentiation corresponds to r ...
. The base for the scaling is normally 2, 10 or 16. The typical number that can be represented exactly is of the form: :''Significant digits'' × ''base''''exponent''


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. Computing terminology