Recommended Language(s) for Performing Arbitrary Precision Calculations on a PC

computational complexitycomputational mathematics

I would be grateful if someone could point me in the direction of a programming language (and also, where I may find good tutorials on it to teach myself) that can perform arbitrary bit-precision computations on a PC. I wish to test some computational theory that I've been working on; and for instance, such involves computing logarithms of very large integers n (some comprised of 75 digits or more) and then using the calculation as part of another computation.

I am leaning towards Haskell; but I have considered Fortran.

Any substantive pros and cons regarding either of these two languages, or even a better choice, would be appreciated.

Finally, I know that arbitrary precision computation is limited by the amount of available storage on one's computer—so I would appreciate it if someone would also tell me what type of PC memory would be needed to compute logarithms accurate to say 1/4th of the bit length of a 75-digit integer?

Thank you.

Best Answer

I have used PARI/GP for decades. It is very easy to use and very capable of arbitrary precision computations. It is GPL software which means it is free to download from source as well as a standalone Windows executable. More information is available on their website. For your intended use, it has several bit oriented operations on integers, including for example:

bitxor(x,y): bitwise "exclusive or" of two integers x and y. Negative numbers behave as if modulo big power of 2.

bittest(x,n): gives bit number n (coefficient of 2^n) of the integer x. Negative numbers behave as if modulo big power of 2.

Related Question