**Connected: An Internet Encyclopedia**

*3.6 Floating-point*

**Up:**
Connected: An Internet Encyclopedia

**Up:**
Requests For Comments

**Up:**
RFC 1832

**Up:**
3. XDR DATA TYPES

**Prev:** 3.5 Hyper Integer and Unsigned Hyper Integer

**Next:** 3.7 Double-precision Floating-point

### 3.6 Floating-point

3.6 Floating-point
The standard defines the floating-point data type "float" (32 bits or
4 bytes). The encoding used is the IEEE standard for normalized
single-precision floating-point numbers [3]. The following three
fields describe the single-precision floating-point number:

S: The sign of the number. Values 0 and 1 represent positive and
negative, respectively. One bit.
E: The exponent of the number, base 2. 8 bits are devoted to this
field. The exponent is biased by 127.
F: The fractional part of the number's mantissa, base 2. 23 bits
are devoted to this field.

Therefore, the floating-point number is described by:

(-1)**S * 2**(E-Bias) * 1.F

It is declared as follows:

float identifier;
+-------+-------+-------+-------+
|byte 0 |byte 1 |byte 2 |byte 3 | SINGLE-PRECISION
S| E | F | FLOATING-POINT NUMBER
+-------+-------+-------+-------+
1|<- 8 ->|<-------23 bits------>|
<------------32 bits------------>

Just as the most and least significant bytes of a number are 0 and 3,
the most and least significant bits of a single-precision floating-
point number are 0 and 31. The beginning bit (and most significant
bit) offsets of S, E, and F are 0, 1, and 9, respectively. Note that
these numbers refer to the mathematical positions of the bits, and
NOT to their actual physical locations (which vary from medium to
medium).

The IEEE specifications should be consulted concerning the encoding
for signed zero, signed infinity (overflow), and denormalized numbers
(underflow) [3]. According to IEEE specifications, the "NaN" (not a
number) is system dependent and should not be interpreted within XDR
as anything other than "NaN".

**Next:** 3.7 Double-precision Floating-point

**Connected: An Internet Encyclopedia**

*3.6 Floating-point*