Normalized vs Denormalized Floating-Point Numbers
You'll learn: How floating-point representation handles very small numbers near zero using denormalized values.
The Problem with Very Small Numbers
In IEEE 754 floating-point format, numbers are stored with an implicit leading 1 bit in the mantissa (the fractional part). For example, in single precision, we store 23 bits but actually represent 24 bits of precision because the leading 1 is assumed.
This works beautifully for most numbers, but creates a gap problem: What happens when you need to represent numbers smaller than the smallest normalized value?
Normalized Numbers
A normalized floating-point number has that implicit leading 1 before the binary point. The exponent field is non-zero, and the number looks like: 1.xxxxx × 2^exponent
This gives excellent precision across a wide range, but the smallest normalized single-precision number is about 1.175 × 10^-38.
Denormalized (Subnormal) Numbers
When the exponent field is all zeros, the floating-point system switches modes. Now:
- The implicit leading bit becomes
0instead of1 - The number format becomes:
0.xxxxx × 2^(smallest_exponent) - These are called denormalized or subnormal numbers
This fills the gap between zero and the smallest normalized number, allowing gradual underflow instead of abrupt jumps.
The Tradeoff
Denormalized numbers sacrifice precision for range. As numbers get closer to zero, you lose significant digits, but you avoid suddenly snapping to zero. Think of it like a dimmer switch rather than an on-off light switch.
Key Takeaway: Denormalized floating-point numbers use a leading 0 bit when the exponent is zero, filling the gap between the smallest normalized value and zero to prevent abrupt underflow, though with reduced precision.