0
$\begingroup$

I want to convert a decimal (base 10) number to its binary (base 10) equivalent. The binary string has to be of infinite length. Is any of the following functions correct for non-negative integers $x$: $$ x = \sum_{i=0}^\infty 2^i $$ or $$ x = \sum 2^i ; i \in \{ 0,1,2,...\} $$ for unique $i$, in both cases.

Edit: I know that a more appropriate function would be $$ x = \sum_{i=0}^\infty y_i2^i ; y_i \in \{ 0,1\} $$ but I wanted to know if any of the above two formulations would be equivalent to this.
Thanks

$\endgroup$
  • $\begingroup$ How would different values of x arise from your formulation? $\endgroup$ – DJohnM Aug 7 '15 at 19:25
  • $\begingroup$ Thanks @DJohnM, edited the question. Will it be correct now $\endgroup$ – user51013 Aug 7 '15 at 19:30
0
$\begingroup$

If your $x$ is between $0$ and $1$, you can write $x=\sum_{i=1}^\infty a_i2^{-i}$ where $a_i \in \{0,1\}$ are binary digits of the expansion. If it is not, you can add the integral part of $x$ converted to binary to this expression. You can't have an infinite binary string to the left of the fraction point as the value would be infinite.

$\endgroup$
  • $\begingroup$ Thanks, but will there be a problem if there are infinite zeros to the left of the binary equivalent number, as in $ ...0001010$ for decimal 10 $\endgroup$ – user51013 Aug 7 '15 at 19:56
  • $\begingroup$ I edited the question while you were answering. could you kindly address the present question. Thanks again $\endgroup$ – user51013 Aug 7 '15 at 19:57
  • $\begingroup$ Neither of the others is equivalent because they do not express the fact that the binary bits can be different. Both say $x=1+2+4+8+\dots$, which is not what you want to do. Your last is not correct because the exponents of $2$ must be negative as I pointed out. $\endgroup$ – Ross Millikan Aug 7 '15 at 20:01
  • $\begingroup$ You mean to say that a binary value with infinite leading zeros is not feasible. But if i do not mean the actual binary value and just use it as an infinite binary string, then will the third function be ok? $\endgroup$ – user51013 Aug 7 '15 at 20:12
  • $\begingroup$ If you are just working with strings, why use a summation? Your third is fine as long as the $y_i$ are eventually all zeros. In that case it is really a finite sum with a finite result. I feel I still do not understand what you are looking for. $\endgroup$ – Ross Millikan Aug 7 '15 at 20:33
0
$\begingroup$

Trying to catch the direction of the question, probably with something like taking advantage of the fact that 10=5*2 y making use of modular arithmetic to calculate the decimal overflow, i could'n t imagine other way without entry in a kind of complex "iterating" stuff... and then transform to binary.

pd: Like a detour... https://en.wikipedia.org/wiki/Quote_notation

$\endgroup$

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.