greg%bosco.Berkeley.EDU@ucbvax.berkeley.edu (Greg) (08/26/89)
I have a program which counts certain combinatorial objects in buch to produce very big numbers. As I optimize my program and do longer runs, I have reached the limit of long ints and double precision floating point mantissas (yes, I want the exact integral value). I need to compute with bignums, but efficiently. What is the best way to do this in C or C++ on a Sun? I would like to multiply two 32-bit digits to yield a 64-bit result which I can divide into two 32-bit digits. I strongly suspect that this only takes one multiply in assembly language. Unfortunately, there is now 64-bit atomic data type in C (and presumably none in C++), so I am stuck with multiplying two 16-bit digits to get a 32-bit digit, i.e. four times as many multiplies. So I can resign myself to inefficiency or learn Sun 3 assembly language and write an assembly routine. Does there exist a library to do bignums? Is there another way to code this in C or C++? Please send a copy of your reply by E-mail. Thanks in advance. --- Greg