Sign, Exponent and Fraction
A single 64-bit float can hold the mass of an electron (about 9 × 10⁻³¹ kg) and the mass of the Sun (about 2 × 10³⁰ kg). No fixed position for the point could cover both. So the point is allowed to float: the number stores its digits and, separately, where the point goes. You already know this idea as scientific notation.
The rule
A float is sign × 1.fraction × 2^exponent — scientific notation in binary.
In decimal, 6,500 is written 6.5 × 10³. A float does the same in base 2. Take 6.5: in binary it is 110.1 (4 + 2 + ½). Slide the point left until one digit is in front of it:
6.5 = 110.1 (binary) = 1.101 × 2²The standard layout (IEEE 754) stores three fields:
| Part | 64-bit double | 32-bit float | For 6.5 |
|---|---|---|---|
| Sign | 1 bit | 1 bit | 0 (positive) |
| Exponent | 11 bits | 8 bits | 2 |
| Fraction | 52 bits | 23 bits | 101000… |
Two details keep it compact. The leading 1 before the point is always 1 for normal numbers, so it is not stored; a double effectively keeps 53 significant bits. And the exponent is stored with a bias added (1023 for doubles) so negative exponents need no sign: exponent 2 is stored as 1025.
53 significant bits are about 15–17 decimal digits; a 32-bit float's 24 bits are about 7 digits. Because the number of significant bits is fixed, the gap between neighbouring floats grows as numbers get bigger. Above 2⁵³ (about 9 × 10¹⁵) a double cannot even store every whole number.
The shortcut
To place any number, write it in binary, then slide the point until a single 1 is in front. The number of places you slid is the exponent: slid left means positive, slid right means negative.
12 in binary
12 = 8 + 4 = 1100.
Drills
Answer fast — trust the rule.
In binary scientific notation, what is the exponent of 12?
How many fraction bits does a 64-bit double store?
About how many significant decimal digits does a 32-bit float keep?
What does a double store for 2⁵³ + 1?
Remember
- A float is sign × 1.fraction × 2^exponent.
- Doubles: 1 + 11 + 52 bits, about 15–17 digits. Floats: 1 + 8 + 23 bits, about 7 digits.
- The trap: precision is fixed in digits, not in size — big numbers have big gaps between them.
