I'm writing a small application that is determining probabilities and in the process is utilizing factorials. Thus, as soon it encounters a situation where it needs to calculate 21! or more - i have a problem.
long is no longer cutting the mustard! I had thought that BigLong or BigInteger might be the answer, but having just glanced at them they seem to be more about precision than a simple increase in the size of the value they represent.
I'm positive there is an answer to my problem, I'm just hoping its a simple solution. Any help would be wonderful.
I had no problem writing a factorial method usint BigInteger that easily works generates factorials of 21 and 22 and above.
What have you tried with BigInteger that didn't work.
Joined: Mar 01, 2006
Well, to be honest - i haven't tried anything with BigInteger yet. I looked at it in the API after encountering the helpful looking class name, but it didn't seem to suggest that it could deal with integers larger than 9223372036854775807 explicity. However, now that you say it can, i will happily go and experiment.