when using bits to represent fractions of a number, can you create all possible fractions? why or why not?
No, using bits you cannot represent all possible fractions of a number. The reason is that with a finite number of bits, you can only hit a finite set of fractional values, while there are infinitely many distinct fractions.
Core idea in plain terms
Think of bits as giving you a number line made of evenly spaced “ticks”.
If you have only, say, 8 bits to the right of the binary point, then you only
get fractions that look like:
k28for integer k\frac{k}{2^8}\quad \text{for integer }k28kfor integer k
So you can get things like
1256,2256,3256,…\frac{1}{256},\frac{2}{256},\frac{3}{256},\dots
2561,2562,2563,…, which simplify to fractions such as
12,34,58\frac{1}{2},\frac{3}{4},\frac{5}{8}21,43,85, etc.
But you cannot get a fraction like 13\frac{1}{3}31 exactly, because
13\frac{1}{3}31 is not equal to k28\frac{k}{2^8}28k for any integer kkk.
Why bits miss many fractions
1. Only denominators that are powers of 2
With a fixed number of binary digits after the point:
- Every representable fraction is of the form a2b\frac{a}{2^b}2ba for some integers a,ba,ba,b.
- That means:
- 12,38,516\frac{1}{2},\frac{3}{8},\frac{5}{16}21,83,165 are fine.
- Fractions like 13,15,110,712\frac{1}{3},\frac{1}{5},\frac{1}{10},\frac{7}{12}31,51,101,127 are not exactly representable with finitely many binary digits.
In binary, many of these “nice looking” decimal fractions become infinite repeating patterns, just like 13=0.333…\frac{1}{3}=0.333\ldots 31=0.333… in decimal.
2. Finite bits vs infinite fractions
- A computer using a fixed number of bits has only finitely many different patterns of bits.
- Each pattern corresponds to one numeric value.
- Therefore:
- A machine with NNN bits for the fractional part can represent at most 2N2^N2N distinct fractional values between 0 and 1.
- But there are infinitely many rational numbers between 0 and 1 alone, let alone all real numbers.
So it is impossible to match every possible fraction exactly with only finitely many bit patterns.
3. What about irrational numbers?
On top of the rational fractions issue:
- Irrational numbers like π\pi π or 2\sqrt{2}2 do not equal any fraction p/qp/qp/q with integers p,qp,qp,q, so they already lie outside the “fraction” world.
- Their binary expansions are infinite and non-repeating.
- A finite bit representation can only approximate them, never capture them perfectly.
How computers handle this in practice
Modern systems use formats such as floating‑point (like IEEE 754) to represent a wide range of numbers:
- A floating‑point number is stored with:
- A sign bit (positive or negative).
- An exponent (powers of 2).
- A fraction/significand (binary digits of the number).
- This lets computers represent:
- Very large and very small magnitudes.
- A dense grid of representable fractions near 0 (but still only certain ones).
Even so:
- The set of representable values is still finite.
- Many fractions (and all irrationals) are stored only as approximations , which is why rounding errors appear in calculations.
Intuitive “story” version
Imagine you have a ruler with only 256 tick marks between 0 and 1:
- You can measure exactly at 0, 1256\frac{1}{256}2561, 2256\frac{2}{256}2562, …, all the way to 1.
- If someone asks for “exactly one third”, you look along the ruler and see:
- One tick at 0.332… (a bit less than 13\frac{1}{3}31)
- Another at 0.336… (a bit more than 13\frac{1}{3}31)
- You can get very close , but you can never land exactly on one third with that ruler.
Bits work like that ruler: precise at certain spots, approximate everywhere else.
Direct answer, in exam style
When using bits to represent fractions of a number, you cannot create all possible fractions. The reason is:
- With a finite number of bits, a computer can represent only those fractions that can be written as a sum of negative powers of 2, i.e., of the form a/2ba/2^ba/2b for integers a,ba,ba,b.
- Many fractions require an infinite binary expansion and therefore cannot be represented exactly with a finite number of bits; they can only be approximated.
- Since there are infinitely many rational numbers (and even more real numbers), but only finitely many bit patterns, not all fractions are representable.
TL;DR:
Bits with finite length can only represent a finite set of fractions whose
denominators are powers of 2, so you cannot create all possible fractions;
many require infinitely many bits and thus must be approximated.
Information gathered from public forums or data available on the internet and portrayed here.