Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jsmwoolf

macrumors regular
Original poster
Aug 17, 2011
123
0
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?
 
Last edited:

denniscote

macrumors newbie
Jul 19, 2011
19
1
GNU MP Bignum library

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.

HTH
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.