0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- Step size of a fixed-point format with f fraction bits? from Lesson 2.1.1
- −23 in 8-bit 2's complement? from Lesson 1.1.1
- How many bits make one hex digit? from Lesson 0.1.2
1 · The Hook
🎣
The distance to the Sun is 1.5 × 10¹¹ m; an atom is 1 × 10⁻¹⁰ m wide. Scientific notation writes both with a few significant digits and an exponent. Computers do the same in binary: sign × 1.fraction × 2^exponent. The IEEE 754 standard fixes exactly which bits store what, and GATE asks you to encode numbers into hex and decode hex back into numbers.
2 · Predict First
🤔
Write 6.5 in binary, then move the point so that exactly one 1 is in front of it. What power of 2 do you need?
Make a guess in your head. The answer opens Section 3.
3 · Core Concept
💡
Predict First — the answer
6.5 = 110.1₂ = 1.101 × 2².
🗣️
In plain words
A floating-point number stores three things: a sign (+ or −), an exponent (how far to move the binary point) and a fraction (the significant bits). Every non-zero binary number starts with a 1 once normalised, so that leading 1 is not stored at all (the "hidden bit"). The exponent is stored with a fixed offset (bias) added, so it can be negative without a sign of its own.
1. Normalised binary scientific notation
Every non-zero number can be written ±1.f × 2ᵉ: −13.25 = −1101.01₂ = −1.10101 × 2³.
2. IEEE 754 single precision (32 bits)
| Field | Bits | Holds |
|---|---|---|
| Sign S | 1 | 0 = positive, 1 = negative |
| Exponent E | 8 | e + 127 (the bias), for normal numbers 1 … 254 |
| Fraction F | 23 | the bits after the point in 1.f |
Value = (−1)^S × 1.F × 2^(E − 127). Double precision (64 bits): 1 sign, 11 exponent bits with bias 1023, 52 fraction bits.
3. Encoding a number (step by step)
Example −13.25:
- Sign: negative → S = 1.
- Binary: 13.25 = 1101.01.
- Normalise: 1.10101 × 2³ → e = 3.
- Exponent field: E = 3 + 127 = 130 = 1000 0010.
- Fraction field: the bits after the point, padded with zeros to 23 bits: 1010 1000 0000 0000 0000 000.
- Put together and group in 4s for hex: 1100 0001 0101 0100 0000 … → C154 0000.
4. Decoding hex
0x4120 0000 = 0100 0001 0010 0000 … → S = 0, E = 1000 0010 = 130 → e = 3, F = 0100… → 1.01₂ × 2³ = 1010₂ = 10.0.
5. Worth memorising
| Number | Hex (single) |
|---|---|
| 1.0 | 3F80 0000 |
| 0.75 | 3F40 0000 |
| −5.0 | C0A0 0000 |
| 10.0 | 4120 0000 |
| 100.0 | 42C8 0000 |
0.1 is not exact in binary: it is stored as 3DCC CCCD (slightly more than 0.1).
4 · Visual
-13.25 in IEEE 754 single precision
S | E (8 bits) | F (23 bits)
1 | 1 0 0 0 0 0 1 0 | 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
| 130 = 3 + 127 | .10101 (the leading 1 of 1.10101 is hidden)
group in 4s: 1100 0001 0101 0100 0000 0000 0000 0000 = C 1 5 4 0 0 0 0
5 · Worked Examples
Example 1 Easy
What is the exponent field E (as a decimal number) for 0.75 in single precision?
Solution
0.75 = 1.1₂ × 2⁻¹ → E = −1 + 127 = 126.
Example 2 Medium
Encode 3.5 in single precision (hex).
Solution
11.1₂ = 1.11 × 2¹ → S 0, E 128 = 1000 0000, F 1100… → 0100 0000 0110 0000 … → 4060 0000.
Example 3 GATE
What number does 0xC0A0 0000 represent?
Solution
S = 1, E = 1000 0001 = 129 → e = 2, F = 01… → −1.01₂ × 2² = −5.0.
6 · GATE Traps
⚠️
- Bias is added when encoding (E = e + 127) and subtracted when decoding.
- The hidden 1 is not stored; F holds only the bits after the point.
- Exponent field E has 8 bits in single precision, 11 in double; bias 127 vs 1023.
- Group all 32 bits in 4s from the left to get the hex digits.
7 · Memory Hook
🧠
"Sign, Exponent + 127, Fraction after the hidden 1."
8 · Connect the Dots
Exponent fields 0 and 255 were left out of the normal range on purpose: they encode zero, tiny denormal numbers, infinity and NaN. The next lesson covers those special values and the range, precision and gaps of floating point.
9 · Self-Test
GATE format. Try every question before opening the vault.
Q1MCQ1 markEncoding
1.0 in IEEE 754 single precision (hex) is:
- (A) 4000 0000
- (B) 3F80 0000
- (C) 3F00 0000
- (D) 0000 0001
Q2NAT1 markExponent field
In single precision, what is the exponent field E (in decimal) for the number 10.0?
Numerical answer: ________
Q3NAT2 marksDecoding
What decimal value is represented by the single-precision pattern 0x42C8 0000?
Numerical answer: ________
Q4MCQ2 marksEncoding
−2.75 in single precision (hex) is:
- (A) C060 0000
- (B) 4030 0000
- (C) C030 0000
- (D) BF30 0000
Q5NAT1 markBias
What is the exponent bias of IEEE 754 double precision?
Numerical answer: ________
10 · Rule Card
- Normalised value: (−1)ˢ × 1.F × 2^(E − bias).
- Single: 1 + 8 + 23 bits, bias 127. Double: 1 + 11 + 52 bits, bias 1023.
- Encode: sign → binary → normalise 1.f × 2ᵉ → E = e + bias → F = bits after the point → hex in groups of 4.
- Decode: split S | E | F, e = E − bias, value = ±1.F × 2ᵉ.
11 · Concept Ledger
Unlocked in this lesson. From here on, these terms may be used.
scientific notation in binarynormalisationsign fieldbiased exponentfraction (mantissa) fieldhidden bitIEEE 754 single precisiondouble precisionencoding to hexdecoding from hex
12 · Answer Vault
Answer Vault
Try the questions first. Open when you are ready to check.
Recall Warm-up
- 2⁻ᶠ.
- 1110 1001.
-
Self-Test
Q1 Answer: (B)1 mark
E = 127 = 0111 1111, F = 0.
- (A) is wrong: That is 2.0.
- (C) is wrong: That is 0.5.
- (D) is wrong: A tiny denormal.
Re-read: Lesson 2.1.2 — Floating point and IEEE 754: sign, biased exponent, mantissa
Q2 Answer: 1301 mark
10 = 1.01 × 2³; 3 + 127.
Re-read: Lesson 2.1.2 — Floating point and IEEE 754: sign, biased exponent, mantissa
Q3 Answer: 1002 marks
E = 133 → e = 6; 1.1001₂ × 2⁶ = 1100100₂.
Re-read: Lesson 2.1.2 — Floating point and IEEE 754: sign, biased exponent, mantissa
Q4 Answer: (C)2 marks
−10.11₂ = −1.011 × 2¹: S 1, E 128, F 011.
- (A) is wrong: That is −3.5.
- (B) is wrong: Positive.
- (D) is wrong: Wrong exponent.
Re-read: Lesson 2.1.2 — Floating point and IEEE 754: sign, biased exponent, mantissa
Q5 Answer: 10231 mark
2¹⁰ − 1.
Re-read: Lesson 2.1.2 — Floating point and IEEE 754: sign, biased exponent, mantissa