3 Replies - 1112 Views - Last Post: 27 November 2010 - 09:25 PM

#1 Guest_lochnessmosnter*


is this representable in binary?

Posted 24 November 2010 - 07:18 PM

ok so i understand it's impossible to represent .01(decimal) in binary...an example i know of would be just like how 1/30 is impossible to represent in decimal

1/30 <--- always gives u .033333.....it goes on forever and i can even prove this by writing out 1 divided by 30 and i notice i keep getting the same number over and over and i am in an infinite loop. my question is how can i prove that .01 cannot be represented in binary form,without using a repeating decimal division problem? in other words i can i prove this by USING only binary digits to get my point across?

is .01(decimal) even representable in binary?

Is This A Good Question/Topic? 0

Replies To: is this representable in binary?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon

Reputation: 14045
  • View blog
  • Posts: 56,201
  • Joined: 12-June 08

Re: is this representable in binary?

Posted 26 November 2010 - 06:57 PM

I would imagine it would have to be representable.. I mean I use floats and doubles regularly on a binary pc, right?

Of course there is always this article..
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: is this representable in binary?

Posted 26 November 2010 - 07:15 PM

It would on what those binary bits mean. if they are some floating point representation then possible.
1/30 could represent using a type the represents rational numbers. (ie it keeps it a fraction)
Was This Post Helpful? 0
  • +
  • -

#4 Nikitin   User is offline

  • D.I.C Regular

Reputation: 56
  • View blog
  • Posts: 264
  • Joined: 02-August 10

Re: is this representable in binary?

Posted 27 November 2010 - 09:25 PM

Guys, you do realize that binary system is a regular number system, just like decimal is, right? It has binary representation, just like decimal has its own representation. Here - http://en.wikipedia...._representation
Binary system is represented in the same way (just replace 10's with 2's).

All these BCD, two's complement, IEEE 754, sign-magnitude, etc... are encodings. That's what you use to represent numbers in computers (mostly), because computers don't have decimal points, negative signs, infinite memory, and many other things.

OP, never really had to do this stuff, but try something like this. I'll be very informal here.

In representation, the number will have some beginning part 'a', and repeating part 'b', both of which may be empty or a zero, of course. So it will be represented as 0.a[b]. Brackets mean 'repeat this stuff forever' (couldn't use parenthesis, formatting issues).

So in terms of infinite sums, you'll have something like:

1/30 = 1 / a * [sum where i = 0 to infinity of (1/r^i)]

The sum itself will range from 1 to 2. Minimum is one, because the first term is one. Maximum is 2 because, well, if r is 2, binary representation will be 1.(1) = 2. So just multiply both sides by some number easily represented in binary to make the left side between 1 and 2. Then solve for r.

In this case it all works out very cleanly. Just let a = 32. Then r would have to be 16. So

1/30 = 0.00001(0001)

It may be a pain in the ass to find 'a' in other cases.

To answer your last question, yes, 0.01 is representable in binary, just like any other digit. It may not have a finite representation though.

This post has been edited by Nikitin: 27 November 2010 - 09:31 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1