Daecon Posted May 18, 2009 Posted May 18, 2009 Is there a way to convert irrational numbers from decimal to binary? Has it already been done?
Shadow Posted May 18, 2009 Posted May 18, 2009 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
Severian Posted May 18, 2009 Posted May 18, 2009 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?
Shadow Posted May 18, 2009 Posted May 18, 2009 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.
Daecon Posted May 19, 2009 Author Posted May 19, 2009 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?
Shadow Posted May 19, 2009 Posted May 19, 2009 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
Severian Posted May 19, 2009 Posted May 19, 2009 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".
Daecon Posted May 19, 2009 Author Posted May 19, 2009 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 mergedAha. 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now