Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Maximum digits in GMP?


    Just like I said in the title, how much big number can be managed by gmp library under plain GCC environment? (does GMP cover infinite length of integer?)

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005


    There is no "infinite number" in computing. You always reach somewhere borders, either by computational complexity or memory. How would you store such a big number in memory? In fact these are also the limitations of GMP.

    Using GMP 5.0, a fast 64-bit computer, and sufficient memory, it should be possible to compute up to 41 billion digits. Unfortunately, the memory requirements are about 8n bytes for computing n digits, which will make most desktop computers unfit for 41 billion digit computations. Memory locality in the FFT multiply code of GMP 5.0's is not good enough for efficient computation with operands on disk.

    Attempting computations of more than 41 billion digits will cause overflow in the mpz type. A planned future version of GMP will allow the patient and wealthy to compute up to at least 1 quadrillion (1015) digits, and unlike current GMP, this future GMP will operate fine with operands on disk. You'll need around 4000 high-end swap disks in order to compute 1 quintillion digits, but surely that will qualify you for a discount ("buy 4000, pay for 3999").

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts