| Author |
Dealing with integers bigger than 9223372036854775807
|
Grant Shannon
Greenhorn
Joined: Mar 01, 2006
Posts: 3
|
|
Hey all, 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.
|
 |
Steve Fahlbusch
Ranch Hand
Joined: Sep 18, 2000
Posts: 491
|
|
Grant, 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.
|
 |
Grant Shannon
Greenhorn
Joined: Mar 01, 2006
Posts: 3
|
|
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. Thanks.
|
 |
Grant Shannon
Greenhorn
Joined: Mar 01, 2006
Posts: 3
|
|
Thanks a bunch Steve - BigInteger worked a treat
|
 |
 |
|
|
subject: Dealing with integers bigger than 9223372036854775807
|
|
|