# IEEE-754 Floating-Point Standard & 2’s Complement Arithmetic
Exam: GATE Computer Science & Information Technology (GATE CS)
Subject: Digital Logic
Canonical URL: https://gateandnet.com/exams/gate-cs/digital-logic/ieee-754-floating-point-and-number-systems

> Exact bit layouts, implicit leading 1, biased exponent, denormalized subnormals, NaN, and range formulas.

## IEEE-754 Bit Layout Comparison

| Format | Total Bits | Sign ($S$) | Biased Exponent ($E$) | Mantissa / Fraction ($M$) | Bias ($2^{k-1}-1$) |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Single Precision (float)** | $32$ | $1$ bit | $8$ bits | $23$ bits | $127$ |
| **Double Precision (double)** | $64$ | $1$ bit | $11$ bits | $52$ bits | $1023$ |

## Special Exponent Encodings (Single Precision)

- **$1 \le E \le 254$:** Normalized number $(-1)^S \times (1.M)_2 \times 2^{E - 127}$
- **$E = 0, \; M = 0$:** Signed Zero ($+0.0$ or $-0.0$)
- **$E = 0, \; M \ne 0$:** Denormalized number $(-1)^S \times (0.M)_2 \times 2^{-126}$ *(Note exponent is $-126$, NOT $-127$!)*
- **$E = 255, \; M = 0$:** $\pm \infty$
- **$E = 255, \; M \ne 0$:** **NaN** (Not a Number)

> [!TIP]
> **Quick Hex-to-Float Conversion Example (`0xC1580000`):**
> 1. Binary: `1 | 10000010 | 1011000...0`
> 2. $S = 1$ (Negative), $E = (10000010)_2 = 130 \implies e = 130 - 127 = 3$.
> 3. Mantissa $(1.1011)_2 = 1 + 0.5 + 0.125 + 0.0625 = 1.6875$.
> 4. Value $= -1.6875 \times 2^3 = \mathbf{-13.5}$.


## Solved Practice Questions & PYQs

### [GATE CS Digital Logic | MCQ]
What is the range of signed integers representable in **$8$-bit 2’s complement** representation?
**Correct Answer:** B
**Solution:** An $n$-bit 2’s complement integer spans $[-2^{n-1},\; +2^{n-1} - 1]$. For $n = 8$, this is $[-2^7,\; 2^7 - 1] = \mathbf{-128 \text{ to } +127}$.

### [GATE CS Digital Logic | MCQ]
In **IEEE-754 single-precision (32-bit)** floating-point format, how many bits are allocated to `[Sign | Biased Exponent | Mantissa Fraction]` respectively, and what is the exponent bias?
**Correct Answer:** A
**Solution:** IEEE-754 32-bit single precision uses **1 sign bit, 8 exponent bits, and 23 fraction bits** ($1 + 8 + 23 = 32$) with bias $2^{8-1} - 1 = \mathbf{127}$.
