Single-Precision Floating Point
XDR defines the single-precision floating-point data type as a float.
The length of a float is 32 bits, or 4 bytes. Floats are encoded using the IEEE standard for normalized single-precision floating-point numbers.
(-1)**S * 2**(E-Bias) * 1.F
Item | Description |
---|---|
S | Sign of the number. This 1-bit field specifies either 0 for positive or 1 for negative. |
E | Exponent of the number in base 2. This field contains 8 bits. The exponent is biased by 127. |
F | Fractional part of the number's mantissa in base 2. This field contains 23 bits. |
See the Single-Precision Floating-Point figure (Figure 1).

The most and least significant bytes of an integer are 0 and 3. The most and least significant bits of a single-precision floating-point number are 0 and 31. The beginning (and most significant) bit offsets of S, E, and F are 0, 1, and 9, respectively. These numbers refer to the mathematical positions of the bits but not to their physical locations, which vary from medium to medium.
The IEEE specifications should be considered when encoding signed zero, signed infinity (overflow), and denormalized numbers (underflow). According to IEEE specifications, the NaN (not-a-number) is system-dependent and should not be used externally.