More efficient way to do Arbitray precision?

Discussion in 'Mac Programming' started by jsmwoolf, Dec 6, 2011.

  1. jsmwoolf, Dec 6, 2011
    Last edited: Dec 7, 2011

    macrumors regular

    Joined:
    Aug 17, 2011
    #1
    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?
     
  2. macrumors newbie

    Joined:
    Jul 19, 2011
    #2
    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
     

Share This Page