Datasheet
Floating-point Support
5-30 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
5.5 IEEE 754 arithmetic
The ARM floating-point environment is an implementation of the IEEE 754 standard
for binary floating-point arithmetic. This section contains a summary of the standard as
it is implemented by ARM.
5.5.1 Basic data types
ARM floating-point values are stored in one of two data types, single precision and
double precision. In this document these are called
float
and
double
. These are the
corresponding C types.
Single precision
A
float
value is 32 bits wide. The structure is shown in Figure 5-3.
Figure 5-3 IEEE 754 single-precision floating-point format
The S field gives the sign of the number. It is 0 for positive, or 1 for negative.
The Exp field gives the exponent of the number, as a power of two. It is biased by
0x7F
(127), so that very small numbers have exponents near zero and very large numbers
have exponents near
0xFF
(255). So, for example:
•if Exp =
0x7D
(125), the number is between 0.25 and 0.5 (not including 0.5)
•if Exp =
0x7E
(126), the number is between 0.5 and 1.0 (not including 1.0)
•if Exp =
0x7F
(127), the number is between 1.0 and 2.0 (not including 2.0)
•if Exp =
0x80
(128), the number is between 2.0 and 4.0 (not including 4.0)
•if Exp =
0x81
(129), the number is between 4.0 and 8.0 (not including 8.0).
The 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. So if Exp is
0x7F
, for example:
•if Frac =
00000000000000000000000
(binary), the number is 1.0
•if Frac =
10000000000000000000000
(binary), the number is 1.5
•if Frac =
01000000000000000000000
(binary), the number is 1.25
•if Frac =
11000000000000000000000
(binary), the number is 1.75.
So 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
)
31 23 2230 0
S
Exp Frac