DTAshley at DTAshley at
Mon Nov 1 22:39:41 CET 2004

Hi Marco,

Two resources come to mind.

First, you may want to review Knuth's classic work, "The Art of Computer Programming" (a 3-volume set), that explains a lot of these basic algorithms.  The best way to do division and multiplication may be counterintuitive.

Second, it is my recollection that the GMP documentation contains a long list of references.

The question you ask (about base-whatever) is the core of how the GMP works.  A computer has a certain basic instruction set that operates on native data types for the computer, and the key question is how to use the instruction set to efficiently operate on larger data types.  This is the key question.

For example, it is possible to do division by comparing and bit-shifting (and if you're doing it in a custom hardware circuit, that might be the best way).  But if you have a processor that has a division instruction that processes operands smaller than you are interested in processing, the best way to scale up is to use that smaller division instruction.

Knuth talks about this in a bit of detail.

Best regards, Dave.

In a message dated 11/1/2004 2:50:27 PM Eastern Standard Time, Marco Bambini <marco at> writes:

>I need to use basic math operations with base256 numbers. Where can I 
>find more
>information (also books, papers, articles etc...) about doing basic 
>math in base256 ?
>(additions, multiplications, division etc..)
>Thanks a lot for your help.
>Marco Bambini
>gmp-discuss mailing list
>gmp-discuss at

More information about the gmp-discuss mailing list