View Full Version : More efficient way to do Arbitray precision?

Dec 6, 2011, 06:40 PM
For a few months, I coded an arbitrary precision system using arrays just to get experience and to solve problems on Project Euler. I'm currently using the decimal number, although I have introduced binary and hexadecimal but on a limiting scale. I have coded addition, subtraction, multiplication, division, square root, power, factorial, etc. and I looking at ways to make it run faster and probably use less memory. I know that arrays aren't the most efficient way to code this kind of stuff, but it's supposed to be a starting point to more advance methods.

So I was wondering if there is a more efficient way to do arbitrary precision using arrays.

EDIT: Does a binary arbitrary execute faster than a decimal arbitrary?

Dec 7, 2011, 10:27 PM
The documentation for the GNU MP Bignum library explains how one of the fastest libraries does arbitrary precision math. See the manual at http://gmplib.org/manual/. The sections on algorithms and internals will probably be useful, and if all else fails you can look at the source code.