|Non-Confidential||PDF version||ARM 100073_0608_00_en|
|Home > Floating-point Support > IEEE 754 arithmetic > Single precision data type for IEEE 754 arithmetic|
float value is 32 bits wide.
The structure is:
S field gives the sign of the number.
It is 0 for positive, or 1 for negative.
Exp field gives the exponent of the
number, as a power of two. It is biased by
so that very small numbers have exponents near zero and very large
numbers have exponents near
0x7D(125), the number is between 0.25 and 0.5 (not including 0.5).
0x7E(126), the number is between 0.5 and 1.0 (not including 1.0).
0x7F(127), the number is between 1.0 and 2.0 (not including 2.0).
0x80(128), the number is between 2.0 and 4.0 (not including 4.0).
0x81(129), the number is between 4.0 and 8.0 (not including 8.0).
Frac field gives the fractional part
of the number. It usually has an implicit 1 bit on the front that
is not stored to save space.
For example, if
00000000000000000000000(binary), the number is 1.0.
10000000000000000000000(binary), the number is 1.5.
01000000000000000000000(binary), the number is 1.25.
11000000000000000000000(binary), the number is 1.75.
In general, the numeric value of a bit pattern in this format is given by the formula:
(–1)S * 2(Exp–0x7F) * (1 + Frac * 2–23)
Numbers stored in this form are called normalized numbers.
The maximum and minimum exponent values, 0 and 255, are special cases. Exponent 255 can represent infinity and store Not a Number (NaN) values. Infinity can occur as a result of dividing by zero, or as a result of computing a value that is too large to store in this format. NaN values are used for special purposes. Infinity is stored by setting Exp to 255 and Frac to all zeros. If Exp is 255 and Frac is nonzero, the bit pattern represents a NaN.
Exponent 0 can represent very small numbers in a special way.
Exp is zero, then the
Frac field has
no implicit 1 on the front. This means that the format can store
0.0, by setting both
all 0 bits. It also means that numbers that are too small to store
Exp >= 1 are stored with less precision
than the ordinary 23 bits. These are called denormals.