home .. forth .. colorforth mail list archive ..

[ColorForth] Arbitrary precision math?



On Wed, 6 Mar 2002, Jack Johnson wrote:

> On Wed, 6 Mar 2002, Frank Kujawski wrote:
> > The chalange with these problems is to find a trick to help factor the
> > number.  After the procedure is found, then the implementation can be
> > done.
> 
> I'm not thinking of the RSA Challenge itself, but the problem of doing
> lots of division with 1024-bit numbers in Forth.
> 
> My initial brain burp was to convert the number as a series of bits stored
> as bytes, and then building a "computer" to process the "bits".  Though
> it's insanely wasteful of space, as Chuck says RAM is cheap, and I want to
> believe (though I haven't tested it) that shuffling around bytes will be
> faster than doing the math to shuffle bits through the chain.
> 
> Either way, it doesn't seem very elegant.  I was just wondering if anyone
> else has any interesting ideas, or has seen or done any work with values
> that neither scale nor fit comfortably in the realm of traditional Forth
> numbers.
> 

On the pentium, it seems the best way is simply long division for the
division of multi-word numbers. Addition can use the hardware adder,
adding the carry of each result to the next result. Multiplication could
use the hardware partially, or it could be done by shifting and adding the
muliplicand appropriately. I don't know which is more efficient.

Mark

------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com