I'm working with factorials around 30! and I can't get a very good result for the value. I only want it accurate to 6 significant figures, or anything that gives a reasonable result. Currently my code is...
static void Main(string[] args)
{
{
int number = 30;
long fact;
factorial(number, out fact);
}
}
public static void factorial(int events, out long eventfact)
{
eventfact = 1;
for (int tt = 1; tt <= events; tt++)
{
eventfact = eventfact * tt;
}
}
This returns the result
-8764578968847253504
this is far from
2.65252859812191E+32
I've looked up about the different types of integers but nothing seems to be large enough for the numbers that I am working with.
Any help would be great!