Sub topic 9
Sign, Biased Exponent, and Mantissa Fields
Assume you know decimal and binary place values, powers of two, and basic binary addition. This chapter develops the fields used to store a normalized floating-point number.
The normalized form
A binary number is normalized when it is written as:
significand × 2^exponent
For a nonzero normalized binary number, the significand has exactly one digit before the binary point:
1.fraction × 2^e
For example:
13.25 = 1101.01₂ = 1.10101₂ × 2³
The three fields store this value:
- The sign field stores whether the number is positive or negative.
- The exponent field stores the exponent in biased form.
- The mantissa field, more precisely called the fraction field, stores the bits after the leading 1.
The sign field
The sign field has one bit:
- 0 means positive.
- 1 means negative.
The sign does not use two's complement. The magnitude is encoded separately, so a negative number is formed by setting the sign bit to 1.
The biased exponent field
The exponent may be negative, but an exponent field is usually treated as an unsigned integer. To store a negative exponent, floating-point formats add a bias:
stored exponent = actual exponent + bias
For an exponent field with k bits, the usual bias is:
bias = 2^(k − 1) − 1
For an 8-bit exponent field, the bias is 127. If the actual exponent is 3, the stored exponent is 130:
3 + 127 = 130 = 10000010₂
When decoding, subtract the bias:
actual exponent = stored exponent − bias
| Format | Sign bits | Exponent bits | Fraction bits | Bias |
|---|---|---|---|---|
| IEEE 754 single precision | 1 | 8 | 23 | 127 |
| IEEE 754 double precision | 1 | 11 | 52 | 1023 |
In IEEE 754, exponent fields containing all zeros or all ones have special meanings. Normalized numbers use neither reserved pattern.
The fraction field and hidden bit
For a normalized value, the leading 1 is guaranteed. IEEE 754 does not store it. Instead, it stores only the fraction after that 1.
For 13.25:
1.10101₂ × 2³
The fraction field begins with 10101. In single precision, it becomes:
10101000000000000000000
The decoded significand is therefore 1.fraction, not 0.fraction. Forgetting this hidden leading 1 produces an incorrect value.
Worked encoding
Encode −13.25 in IEEE 754 single precision:
- Sign: 1
- Normalized form: 1.10101₂ × 2³
- Stored exponent: 3 + 127 = 130 = 10000010₂
- Fraction: 10101 followed by zeros
The 32-bit pattern is:
1 | 10000010 | 10101000000000000000000
Common errors
- Storing the actual exponent instead of the biased exponent.
- Storing the leading normalized 1 in the fraction field.
- Treating the sign bit as part of a two's-complement value.
- Using the reserved exponent patterns as ordinary normalized numbers.
Exercise
A custom format has a 5-bit exponent field with the usual bias. What stored exponent represents the actual exponent −3?
Show answer
The bias is 2^(5 − 1) − 1 = 15. Therefore, the stored exponent is −3 + 15 = 12, or 01100₂.