Binary Fractions
In Topic 1b we considered how a binary bit string like 010111002 could be translated to an unsigned integer. Based on the material in Topic 1b we would translate this string to be the decimal value 92 (64+16+8+4).
But how do we extend binary notation to accommodate fractional values?
To do this, computers use a radix point (aka binary point) in the same role as the decimal point in base‑10 notation. The digits to the left of the radix represent the integer part while the digits to the right of the radix represent the fractional part. Their place values continue the same pattern of powers of two — but now using negative exponents.
| Position | 2³ | 2² | 2¹ | 2⁰ | 2⁻¹ | 2⁻² | 2⁻³ | 2⁻⁴ |
|---|---|---|---|---|---|---|---|---|
| Value | 8 | 4 | 2 | 1 | 1/2 | 1/4 | 1/8 | 1/16 |
Notice this is simply a continuation of the rule you already know: Each position is worth twice as much as the one to its right. Or the other way of looking at it — especially helpful to the right of the radix point — each position is half of the value to its left.
Example: Decoding a Fraction
Before we look at a full example, let's start with a simple warm-up. Consider the bit string 0001.10002. The integer part is 0001 = 1, and the fractional part is 1000 — only the 1/2 bit is set, so the fractional part is 0.5. Thus 0001.10002 = 1.5. Just one integer bit and one fractional bit turned on — easy to verify.
Now let's consider what it means to decode the bit string 010111002 using the simplified encoding we just presented. If we consider a place value table like we were working with in Topic 1b we might write:
Integer part:
Recall that for this simplified encoding we are going to take the first 4 bits and treat that as the integer portion. The first 4 bits are 01012.
- 0 × 23 = 0
- 1 × 22 = 4
- 0 × 21 = 0
- 1 × 20 = 1
Total: 5
Fractional part:
The second 4 bits are treated as the fractional portion. The second 4 bits are 11002.
- 1 × 2-1 = 1/2
- 1 × 2-2 = 1/4
- 0 × 2-3 = 0
- 0 × 2-4 = 0
Total: 1/2 + 1/4 = 3/4
Thus: 0101.11002 = 5 + 3/4 = 5.75
Check: 4 + 1 + 1/2 + 1/4 = 5.75 ✓
Now You Try
Convert the 8‑bit string 101101102 to its decimal/fractional equivalent, using the first 4 bits as the integer and the last 4 bits as the fraction.
Show answer
Integer part (first 4 bits: 1011):
- 1 × 8 = 8
- 0 × 4 = 0
- 1 × 2 = 2
- 1 × 1 = 1
Integer total: 11
Fractional part (last 4 bits: 0110):
- 0 × 1/2 = 0
- 1 × 1/4 = 1/4
- 1 × 1/8 = 1/8
- 0 × 1/16 = 0
Fractional total: 1/4 + 1/8 = 3/8 = 0.375
101101102 = 11.375
Check: 8 + 2 + 1 + 0.25 + 0.125 = 11.375 ✓