Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support storing integers larger than 2^31 bytes? #5

Open
csq1011 opened this issue May 16, 2017 · 6 comments
Open

Support storing integers larger than 2^31 bytes? #5

csq1011 opened this issue May 16, 2017 · 6 comments

Comments

@csq1011
Copy link

csq1011 commented May 16, 2017

Hi,

We're using gmp to run on large inputs, and we are wondering if it is possible for gmp to support storing integers larger than 2^31 bytes.

Thank you!

@cznic
Copy link

cznic commented May 17, 2017

5+ billion digit number 😮

@ncw
Copy link
Owner

ncw commented May 17, 2017

This will depend entirely on libgmp.

I found a message on the mailing list from 2012 which states

The hard limit for mpz is 2^32-1 bits, on a 32-bit machine, and (as Paul says) about 2^37-64 bits on a 64-bit machine.

This library uses what libgmp calls mpz to store its Int type.

So assuming you are using a 64 bit machine you should be good for ~2^34 bytes or numbers of up to 41 billion decimal digits..

It is possible that this limit has been raised since 2012 - I don't know!

@zugzwang
Copy link

zugzwang commented May 6, 2020

Hello, this can be patched for binary input/output. See https://github.com/zugzwang/batchgcd, which contains an update from the patch provided in factorable.net.
I am not in need of this (and I don't think there are many use cases out there - cryptography, and I recall reading something related in record computations of the partition function), but I was wondering if this is feasible in your current library.

@ncw
Copy link
Owner

ncw commented May 6, 2020

@zugzwang you can certainly output the integers as binary - see the Bytes method - I'm not sure how efficient it is though!

@zugzwang
Copy link

zugzwang commented May 7, 2020

Hi @ncw, I was referring to the disk input/output of binary numbers larger than 2**31 (representing larger numbers is of course fine). This can only be achieved in gmp with the patch, so I was only wondering if you had a way around it.

@ncw
Copy link
Owner

ncw commented May 7, 2020

@zugzwang not currently!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants