← 🔢 Number Representation & Computer Arithmetic
Subtopic 6 of 9

4.6Special values

The idea

Some exponent patterns are reserved for special values: zero, denormals, infinity and NaN.

Think of it like this: Road signs with special meanings, not normal speeds.

Why it exists

It lets the hardware represent 0, overflow and 0/0 sensibly instead of crashing.

How it works

  1. Exponent 0, fraction 0 → ±0.
  2. Exponent 0, fraction ≠ 0 → denormal: 0.f × 2−126 (no hidden 1).
  3. Exponent all 1s, fraction 0 → ±∞.
  4. Exponent all 1s, fraction ≠ 0 → NaN.

Worked example: 0x7F800000

Exponent = 255 (all ones), fraction 0, so it is +∞.

Now play with it

  • →Click each preset and read the "Class" box.
00000000000000000000000000000000
ClassZero
Hex0x00000000
Stored exponent0
Unbiased (E − 127)-
Significand0.000000000000…
Value0

Type a decimal, or hex like 0x40490FDB. Colours: sign, exponent, fraction.

Check yourself

In single precision the exponent is all 1s and the fraction is non-zero. What is it?

Remember: All-ones exponent: ∞ or NaN. Zero exponent: 0 or denormal.
Exam notes (the dense version)

e = 0, f = 0 → ±0 · e = 0, f ≠ 0 → denormal 0.f × 2−126 · e = all 1s, f = 0 → ±∞ · e = all 1s, f ≠ 0 → NaN.

Previous year questions: Number Representation & Computer Arithmetic (19)

PYQs are grouped by topic, so this is the full set for Number Representation & Computer Arithmetic; try the ones that match this subtopic. Open all 19 on the topic page.