devX
devX

Reputation: 65

Large Inputs in JAVA

I have to solve a problem in java which has an input consisting of 10^100 digits. How can I take such a large input and process it.I am using JAVA as my programming language.

Upvotes: 0

Views: 442

Answers (1)

keshlam
keshlam

Reputation: 8058

Are all those digits actually significant? Or do you just have a value like 1.234567890123456789 * 10^100?

As others have noted, having 10^100 essential digits would essentially mean you can stop now and write off your problem as uncomputable. You've either misunderstood it, or you shouldn't be approching it via brute-force number crunching. Or both.

If you don't need all the lower-order digits, then floats or doubles may do the job for you. If you need more digits of precision than a double can handle (but still a REASONABLE number), an extended-precision floating point package such as BigFloat might get you there.

If you told us what you were actually trying to do, we could tell you more about whether there's any reasonable way to do it.

Upvotes: 7

Related Questions