I'm thinking about using the BigInteger class to store numbers in the range of 10-1000 MB. Does anyone have experience with this? Are there practical or implied limits for extremely large numbers?
Well, the documentation for BigInteger says that the numbers can be of any size as long as you have enough memory to handle it.
Regular operations (add, subtract, multiply and so on) on a BigInteger are much slower (at least 50x according to some tests) than regular numeric types, but you can probably live with that.
Also, you must remember that the BigInteger type is immutable, so operations on it will yield a new instance. So adding two 10MB numbers will create a new 10MB number. It will not modify the existing instances. This may have implications for how you structure your code.
The only practical limitations is the amount of memory available on your computer and the amount of memory available to your program. This should be at least 3GB for 32bit processes, more for 64bit, so you should be able to work with the numbers you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With