0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- Exponent field of 1.0 in single precision? from Lesson 2.1.2
- Value of 0xC0A0 0000? from Lesson 2.1.2
- Truncation error bound in fixed point with f fraction bits? from Lesson 2.1.1
1 · The Hook
🎣
What is 1 ÷ 0? What is √−1? A program shouldn't crash on them, and numbers far smaller than the smallest normal number shouldn't suddenly jump to 0. IEEE 754 reserves the all-0 and all-1 exponent patterns for these jobs. This lesson also answers GATE's favourite floating-point questions: the largest and smallest values, how many numbers lie between two powers of 2, and how big the gaps are.
2 · Predict First
🤔
In single precision, between 1 and 2 the exponent is fixed and the 23 fraction bits vary. How many different floating-point numbers are there in [1, 2)? How far apart are they?
Make a guess in your head. The answer opens Section 3.
3 · Core Concept
💡
Predict First — the answer
2²³ numbers, spaced 2⁻²³ apart.
🗣️
In plain words
Exponent field all 0s means "tiny or zero" and drops the hidden 1. Exponent field all 1s means "infinity or not-a-number". Everything in between is an ordinary normalised number. Floating-point numbers are packed tightly near 0 and spread out for big values: the gap doubles every time you pass a power of 2.
1. The four special cases (single precision)
| E field | F field | Meaning | Value |
|---|---|---|---|
| 0 | 0 | zero (+0 or −0) | 0 |
| 0 | ≠ 0 | denormal (subnormal) | (−1)ˢ × 0.F × 2⁻¹²⁶ |
| 1 … 254 | any | normal | (−1)ˢ × 1.F × 2^(E − 127) |
| 255 | 0 | ±infinity | ±∞ (e.g. 1/0) |
| 255 | ≠ 0 | NaN (not a number) | e.g. 0/0, √−1 |
Denormals use exponent −126 (not −127) and no hidden 1, so they fill the gap between 0 and the smallest normal number evenly.
2. Range
| Column 1 | Single | Double |
|---|---|---|
| Largest normal | (2 − 2⁻²³) × 2¹²⁷ ≈ 3.4 × 10³⁸ | (2 − 2⁻⁵²) × 2¹⁰²³ ≈ 1.8 × 10³⁰⁸ |
| Smallest positive normal | 2⁻¹²⁶ ≈ 1.18 × 10⁻³⁸ | 2⁻¹⁰²² |
| Smallest positive denormal | 2⁻¹⁴⁹ ≈ 1.4 × 10⁻⁴⁵ (0x0000 0001) | 2⁻¹⁰⁷⁴ |
3. Precision and gaps
- Significant bits: 24 in single (23 stored + hidden 1, about 7 decimal digits), 53 in double (about 15–16 digits).
- Between 2ᵉ and 2ᵉ⁺¹ there are 2²³ equally spaced numbers; the gap (one unit in the last place) is 2^(e − 23). [1, 2): gap 2⁻²³. [2²⁰, 2²¹): gap 2⁻³ = 0.125.
- All integers up to 2²⁴ are exact; 2²⁴ + 1 = 16,777,217 is not (it rounds to 2²⁴).
4. Floating-point arithmetic
To add: align the exponents (shift the smaller number's significand right), add, normalise, round. Consequences:
- Adding a tiny number to a huge one may change nothing: 2²⁴ + 1 = 2²⁴ in single precision.
- Addition is not associative: (2²⁴ + 1) + 1 = 2²⁴ but 2²⁴ + (1 + 1) = 2²⁴ + 2.
5. Custom formats (GATE often invents one)
Same rules, different sizes. Toy 8-bit format: 1 sign, 4 exponent (bias 2³ − 1 = 7), 3 fraction:
- Largest normal: E = 1110, F = 111 → 1.111₂ × 2⁷ = 240.
- Smallest positive normal: E = 0001, F = 000 → 2⁻⁶ = 1/64.
- Smallest positive denormal: E = 0000, F = 001 → 0.001₂ × 2⁻⁶ = 1/512.
General bias for k exponent bits: 2ᵏ⁻¹ − 1.
4 · Visual
Where floats live (toy format, positive side)
0 denormals: evenly spaced 1/512 apart | normals: gap doubles at every power of 2
|.......|.......| 1/64 1 2 4 8 ... 240
0 1/512 7/512 -> 1/64 |-|-|-|-|-|-|-|-|---|---|-------|-------|
8 numbers per [2^e, 2^(e+1)), gap 2^(e-3)
5 · Worked Examples
Example 1 Easy
What does the single-precision pattern 0x7F80 0000 represent?
Solution
S 0, E = 1111 1111, F = 0 → +∞.
Example 2 Medium
In single precision, what is the gap between consecutive floats in [2²⁰, 2²¹)?
Solution
2^(20 − 23) = 2⁻³ = 0.125.
Example 3 GATE
Toy format (1 sign, 4 exponent bits with bias 7, 3 fraction bits). What is the largest finite positive value?
Solution
E = 14, F = 111 → 1.875 × 2⁷ = 240.
6 · GATE Traps
⚠️
- Denormals use 2⁻¹²⁶ (= 1 − bias), not 2⁻¹²⁷, and no hidden 1.
- E = 255 (all 1s) is never a normal number: the largest normal uses E = 254.
- The gap depends on the exponent: precision is relative, not absolute.
- Bias for k exponent bits is 2ᵏ⁻¹ − 1 (k = 4 → 7, k = 5 → 15).
7 · Memory Hook
🧠
"E = 0: zero or denormal (0.F × 2^(1 − bias)). E = all 1s: ∞ or NaN. Gap = 2^(e − fraction bits)."
8 · Connect the Dots
Phase 2 is complete, and with it all of number representation. Phase 3 turns from numbers to logic: the gates that process bits and the algebra that describes them.
9 · Self-Test
GATE format. Try every question before opening the vault.
Q1MCQ1 markSpecial values
In single precision, an exponent field of all 1s with a non-zero fraction means:
- (A) +∞
- (B) the largest normal number
- (C) NaN
- (D) a denormal number
Q2NAT1 markSmallest denormal
The smallest positive single-precision denormal is 2ᵏ. What is k?
Numerical answer: ________
Q3NAT2 marksGap
How many single-precision floating-point numbers are there in the interval [4, 8)?
Numerical answer: ________
Q4NAT2 marksToy format
Format: 1 sign bit, 4 exponent bits (bias 7), 3 fraction bits, IEEE rules. What value does the pattern 1 1000 100 represent?
Numerical answer: ________
Q5MCQ2 marksPrecision
Which of these integers cannot be stored exactly in single precision?
- (A) 8,388,609
- (B) 16,777,217
- (C) 16,777,216
- (D) 16,777,218
10 · Rule Card
- E = 0, F = 0: ±0. E = 0, F ≠ 0: denormal (−1)ˢ × 0.F × 2^(1 − bias). E = all 1s: ±∞ (F = 0) or NaN.
- Single: max ≈ 3.4 × 10³⁸ ((2 − 2⁻²³) × 2¹²⁷), min normal 2⁻¹²⁶, min denormal 2⁻¹⁴⁹.
- Precision: 24 bits (single), 53 (double). Gap in [2ᵉ, 2ᵉ⁺¹) = 2^(e − 23); integers exact up to 2²⁴.
- Float addition aligns exponents; not associative. Bias for k exponent bits = 2ᵏ⁻¹ − 1.
11 · Concept Ledger
Unlocked in this lesson. From here on, these terms may be used.
zero in IEEE 754denormal (subnormal) numbersinfinityNaNlargest and smallest normal numberssmallest denormalsignificant bitsunit in the last place (gap)exact integer rangefloating-point additionnon-associativitycustom floating-point formats
12 · Answer Vault
Answer Vault
Try the questions first. Open when you are ready to check.
Recall Warm-up
-
- −5.0.
- Less than 2⁻ᶠ.
Self-Test
Q1 Answer: (C)1 mark
Not a number.
- (A) is wrong: Needs F = 0.
- (B) is wrong: Uses E = 254.
- (D) is wrong: Needs E = 0.
Re-read: Lesson 2.1.3 — IEEE 754 special values, denormals, range, precision and gaps
Q2 Answer: -1491 mark
2⁻¹²⁶ × 2⁻²³.
Re-read: Lesson 2.1.3 — IEEE 754 special values, denormals, range, precision and gaps
Q3 Answer: 83886082 marks
2²³, one per fraction pattern.
Re-read: Lesson 2.1.3 — IEEE 754 special values, denormals, range, precision and gaps
Q4 Answer: -32 marks
E = 8 → e = 1; −1.100₂ × 2¹ = −3.
Re-read: Lesson 2.1.3 — IEEE 754 special values, denormals, range, precision and gaps
Q5 Answer: (B)2 marks
2²⁴ + 1 needs 25 significant bits.
- (A) is wrong: Below 2²⁴, all integers are exact.
- (C) is wrong: 2²⁴ is exact.
- (D) is wrong: Even numbers near 2²⁴ are exact (gap 2).
Re-read: Lesson 2.1.3 — IEEE 754 special values, denormals, range, precision and gaps