Converting rational number to a new base.

  • Context: Undergrad 
  • Thread starter Thread starter battery2004
  • Start date Start date
  • Tags Tags
    Base Rational
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 8K views
battery2004
Messages
9
Reaction score
0
Hello,

I found one exercise - convert a rational number 63/64(base - 10) to a number system with a base of 4 using Radix conversion.

Searching through the internet i found this formula (i hope it`s the correct one :) ) -
http://img255.imageshack.us/img255/903/races3.jpg

Unlike integer type conversion formula, this is a little unclear. As i understand - the "C" is the number that i want to convert and "r" is the new base, but how many steps do i need to perfom (in the formula i = -1,-2,-3,-4...-n )? And how exactly do i sum these coefficients C?

Thanks in advance.
 
Last edited by a moderator:
Physics news on Phys.org
maybe someone has another idea how to turn 63/64 into a number with a base of 4?
 
Last edited by a moderator:
battery2004 said:
maybe someone has another idea how to turn 63/64 into a number with a base of 4?

Is it just this this problem you want to solve or are you looking for a general solution for all repeating decimals? For this problem, since the denominator is a perfect power of the base, all that needs to be done is convert the numerator to base 4 and shift the decimal to the left by the number of places equal to the power.
 
Yes. Or think of it this way...

in decimal, one position to the left of the decimal is the 10^0 place, two positions is the 10^1 place, etc. One position to the right of the decimal is the 10^-1 place, two positions is the 10^-2 place, etc.

To write the number 63/64 in decimal, we look for a sum of the form a10^0 + b10^-1 + c10^-2 + ...

For 63/64, we com e up with 0.984375 because 9*10^-1, 8*10^-2, 4*10^-3, 3*10^-4, 7*10^-5, and 5*10^-6 all add up to give 63/64.

To do 63/64, all you have to do is replace 10 with 4 and find new constants. An example:

(7+13/16) = (1)(4) + (3)(1) + (3)(1/4) + (1)(1/16) so you would get 13.31 as your answer.
 
It's not quite clear to me what you mean. You talk about rational numbers and give an example in which the number as a fraction. Do you mean write it as a fraction (just convert numerator and denominator) in the new base, or in "decimal" (not quite the right word!) form in base 4?

For the example 63/64, 64= 43 so it is 10004. 63 is one less than 64 so it is 3334. As a fraction 63/64= (333/1000)4. That, of course, is 0.3334.

If the denominator were not a power of 4, that division would be considerably harder!