Is there any fast algorithm to convert numbers with fractions (very big numbers - up to 400 digits) between different bases (where the base ib is 2<=b<=36)??
For example:1100,1100 (base 2) to number with base 7...
PLEASE HELP!!!
Number with fraction conversion...
Moderator: Board moderators
For integers you can use the same algorithm as when converting e.g. from base 10 to base 2 -- divide the number by the new base, the reminder is the last digit of its new representation, and so on.
E.g.
10110 (base 2) to base 7:
10110 : 111 = 11, reminder 1 => last digit is 1
11 : 111 = 0, reminder 11 => previous digit is 11 (base 2), i.e. 3
Therefore 10110 (base 2) = 31 (base 7):
There is a problem with rational numbers -- the representation of a number may be finite in some bases and infinite in other ones. E.g. consider the number 0.2 (base 10). In base 2, this number is 0.0011001100110011...
E.g.
10110 (base 2) to base 7:
10110 : 111 = 11, reminder 1 => last digit is 1
11 : 111 = 0, reminder 11 => previous digit is 11 (base 2), i.e. 3
Therefore 10110 (base 2) = 31 (base 7):
There is a problem with rational numbers -- the representation of a number may be finite in some bases and infinite in other ones. E.g. consider the number 0.2 (base 10). In base 2, this number is 0.0011001100110011...