[Math] Exact representation of floating point numbers

binaryfloating point

Why do 1000.5, 1/16 and 1.5/32 have an exact representation in an arbitrary (finite) normalized binary floating point number system but 123.4, 0.025 and 1/10 don't? How can this easily been seen without trying to create the complete floint point number?

Best Answer

Written as fractions in lowest terms, the denominator is a power of $2$ for those having a finite binary representation

So

  • $1000.5 = \dfrac{2001}{2^1}$,
  • $1/16=\dfrac{1}{2^4}$ and
  • $1.5/32=\dfrac{3}{2^8}$

while

  • $123.4= \dfrac{617}{2^0\times 5}$,
  • $0.025= \dfrac{1}{2^3\times 5}$ and
  • $1/10= \dfrac{1}{2^1\times 5}$

all having non-powers of $2$ in the denominator.

By comparison, for decimal fractions to have a finite representation, the denominator of the lowest terms fraction should be a a power of $2$ times a power of $5$ since the the prime factorisation of $10$ is $2 \times 5$

Related Question