I am looking for a Java library that can handle truly huge numbers or suggestions as to how to implement this myself. We are talking way beyond BigInteger
. How about 2^39614081257132168796771974655+1 for example.
Clearly I could, theoretically, make use of a TreeSet<BigInteger>
, one entry per bit and do all the math old-school but I am looking for something that can actually do some real maths with these numbers using built-in math hardware. I don't expect anything truly fast but I would very much like to get close.
It is likely that the number of set bits may be quite small - I am representing G2 polynomials.
Does anyone know of anything out there?
I suspect a feature of the package must be a setBit(BigInteger i)
.
Added
Thanks for the suggestion of Apfloat. Sadly the following is not possible. It complains that the second parameter must be a long
.
Apint two = new Apint(2);
Apint big = new Apint("39614081257132168796771974655");
ApintMath.pow(two, big);
Please note that I am also open to suggestions as to how to do this myself.
Added - to attempt a reopen.
Please see user2246674's post reminding us how staggeringly enormous these numbers are - I can assure you we are not talking about some ordinary math library here, we are talking some serious Math.pow(age-of-the-universe,atoms-in_the_galaxy)
kind of numbers - we are certainly not looking for mere opinionated answers.