Sign, Exponent, and Mantissa Explained

Deep dive into the three components of IEEE 754 floating-point numbers: the sign bit, biased exponent, and mantissa (significand) with worked examples.

Fundamentals

Decimal Value

-6.5

Float32 Hex

0xC0D00000

Float64 Hex

0xC01A000000000000

Detailed Explanation

Every IEEE 754 floating-point number is composed of three fields that work together to represent a value using scientific notation in base 2. Understanding each field is the key to mastering floating-point arithmetic.

1. The Sign Bit

The sign bit is the most significant bit. It is 0 for positive numbers (including +0 and +Infinity) and 1 for negative numbers (including -0 and -Infinity). For NaN values, the sign bit can be either 0 or 1.

2. The Exponent Field (biased)

The exponent is stored with a bias so that negative exponents can be represented without a separate sign bit. For float32, the bias is 127; for float64, it is 1023. The actual exponent equals the stored value minus the bias.

Special exponent values:

  • All zeros (0): denormalized number or zero
  • All ones (255 for float32, 2047 for float64): infinity or NaN
  • 1 to 254 (float32) / 1 to 2046 (float64): normalized number

3. The Mantissa (Significand)

For normalized numbers, there is an implicit leading 1 that is not stored. The mantissa field represents the fractional part. So the actual significand is 1.mantissa_bits in binary.

For denormalized numbers, the implicit bit is 0 instead of 1, giving a significand of 0.mantissa_bits.

Worked example: -6.5

  1. Convert 6.5 to binary: 110.1
  2. Normalize: 1.101 x 2^2
  3. Sign = 1 (negative)
  4. Exponent = 2 + 127 = 129 = 10000001 in binary
  5. Mantissa = 101 followed by 20 zeros (23 bits total)

Result: 1 10000001 10100000000000000000000 = 0xC0D00000

Verification: (-1)^1 x (1 + 0.5 + 0.125) x 2^2 = -1 x 1.625 x 4 = -6.5

The implicit bit trick:

By not storing the leading 1 for normalized numbers, IEEE 754 gains one extra bit of precision for free. This means float32 effectively has 24 bits of significand precision even though only 23 are stored, and float64 has 53 bits even though only 52 are stored.

Use Case

Understanding sign, exponent, and mantissa decomposition is critical when debugging numerical algorithms, implementing custom serialization of floating-point data, or working on compilers and interpreters that must correctly handle IEEE 754 arithmetic.

Try It — IEEE 754 Inspector

Open full tool