Jump to content

Irrational numbers in binary?

Featured Replies

Is there a way to convert irrational numbers from decimal to binary? Has it already been done?

Sure...while I'm not absolutely positive, I think it's the same as converting any number with a fractional part. Just keep fitting in powers of two. When you get to [math]2^0[/math], you just go on with [math]2^{-1}, 2^{-2}[/math] etc...but since it's irrational you'll just keep going on for ever. Here are the first few digits of Pi in binary (source: Wiki)

 

11.00100100001111110110...

 

Here's [math]\sqrt {2}[/math](wiki again):

 

1.0110101000001001111...

 

An algorithm for converting fractional numbers into binary is described in the wiki article on the binary numeral system. You should also have a look at representing real numbers.

 

Hope this helps,

 

Gabe

Is there a way to convert irrational numbers from decimal to binary? Has it already been done?

 

Surely an irrational number can't be written down in decimal in the first place? :confused:

I'm sure Transdecimal knows what irrational numbers are. And in any case, he didn't say "write down with a finite number of digits", he said "convert from decimal to binary". Which is very possible, unless there's a catch in that sentence I'm missing.

  • Author

Well take Pi for example, which begins with 3 and then 1/10ths, 4/100ths, 1/1'000ths, 5/10'000ths, 9/100'000ths... and so on.

 

How would you write those fractions in binary and then string them together?

Using the algorithm on wikipedia, you just have to take Pi in decimal to the number of digits you want, and then convert to binary. That, or fit in powers of two. Eg 3, 14... -> [math]2^1 + 2 ^ 0[/math], a you get left with 0.14... in decimal and 11 in binary. Now you just go on:

 

[math]0.1415926... = 0 \cdot 2^{-1} + 0 \cdot 2^{-2} + 1 \cdot 2^{-3} +....[/math]

 

Hope this helps,

 

G

I'm sure Transdecimal knows what irrational numbers are. And in any case, he didn't say "write down with a finite number of digits", he said "convert from decimal to binary". Which is very possible, unless there's a catch in that sentence I'm missing.

 

As soon as you have converted it to decimal, it ceases to be an irrational number. So it is impossible to "convert and irrational number from decimal to binary".

  • Author

Maybe I should have said "represent an irrational number in binary", then.

 

Instead of using decimal with it's 1/10ths, 1/100ths, 1/1000ths, etc. and by using binary with it's 1/2ths, 1/4ths, 1/8ths, 1/16ths, etc...


Merged post follows:

Consecutive posts merged

Aha. I understand now.

 

The Wikipedia entry was no help whatsoever as I couldn't understand a word of it, but I googled and found http://cs.furman.edu/digitaldomain/more/ch6/dec_frac_to_bin.htm which explained it much better.

 

I see where I was getting confused. :)

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.