How can I prove that float number $x$ has the finite binary representation if and only if it is written like that: $ x = m / 2^n $, where $m, n \in \mathbb N$.

Should I consider something like 3 different cases for this format or can I do this in different way?

Thank you.

  • $\begingroup$ If you're talking about proving things, you have to start with a precise statement of the problem! A real number can be negative, but $m,n \in \mathbb N$ can't be. So the statement is false. $\endgroup$ – TonyK Oct 13 '14 at 19:00
  • $\begingroup$ I once asked myself how to prove that a person cannot be $\frac{1}{3}$ of a certain ethnicity, or $\frac{2}{5}$ , or whatever other fraction which cannot be written as $\frac{m}{2^n}$. I believe it's an equivalent question. $\endgroup$ – barak manos Oct 13 '14 at 19:01

Here is a proof for positive rational numbers:

Let $x=\dfrac{m}{2^n}$ where $m,n\in\mathbb{N}$

Then $x=a+\dfrac{b}{2^n}$ where $a,b,n\in\mathbb{N}$ and $b<2^n$

Then length of the binary representation of $x$ is $\lceil\log_2(a+1)\rceil+n$

Let $a\in\mathbb{N}$ be the binary representation of the integer part of $x\in\mathbb{Q}$

Let $b\in\mathbb{N}$ be the binary representation of the fraction part of $x\in\mathbb{Q}$

Then $x=a+\frac{b}{2^{|b|}}=\frac{m}{2^n}$ where $m=a\cdot2^{|b|}+b,n=|b|\in\mathbb{N}$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.