base conversion of large numbers 
Author Message
 base conversion of large numbers

Hi !

I know how to convert between different bases , but I would like
to convert from decimal to binary and I want to convert a Number that is
only limited by memory not by 'longint'

I know there is 'some' way to do this with an array , but I am not that
experienced yet

If you could help me with source code , this would be great , because I
have not much idea about implementing it in Pascal , or maybe there is
an URL . ?

please help

thank you

Mike



Sun, 25 Feb 2001 03:00:00 GMT  
 base conversion of large numbers

Quote:

> Hi !

> I know how to convert between different bases , but I would like
> to convert from decimal to binary and I want to convert a Number that
> is
> only limited by memory not by 'longint'

> I know there is 'some' way to do this with an array , but I am not
> that
> experienced yet

     Converting to binary is pretty simple.  The first thing to decide
is how you want to
represent the binary number.  I'll assume you are going to represent it
by a string of '0'
and '1' characters.

     If the number is 0 (in decimal), then it is '0' (in binary).  If it
is odd, its LSC (least significant character) is '1', otherwise it is
'0'.  Finally, if you can divide the number by 2 (throwing away the
remainder), then
    binarystring (number) = binarystring (number div 2) + LSC
where by "+" I mean concatenate strings and LSC is just the character
described in the
second step.

     This is a recursive definition.  It is pretty simple to turn it
into a recursive procedure.
You need to supply methods for determining if the number is odd or even,
and for
dividing it by 2.

Bob Schor
Pascal Enthusiast



Fri, 02 Mar 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. base conversion of large numbers

2. Base 10/Base 2 or Base 2/Base 10 conversion

3. Tutorial on number conversion, any base

4. Program for number conversion, bases 2..72

5. Tutorial on number conversion, any base

6. Program for number conversion, bases 2..72

7. base conversion

8. Delphi, SQL Base, and a large Project?

9. Numbers Conversion

10. number conversion in pascal

11. Conversion from numbers to words

12. Number conversions

 

 
Powered by phpBB® Forum Software