The program is a Poisson Distribution, but when the number is very large, the factorial is imprecise and adds a few thousandths.
How could double make more precision? Or is there a value with larger size?
for (int x = 0; x <= 15; x++)
{
Console.WriteLine("\n\nx:{0} -------------------------- ", x);
double num1 = Math.Pow(e, -lambda);
double num2 = Math.Pow(lambda, x);
double num = num1 * num2;
fact = 1;
for (i = 1; i <= number; i++)
{
fact = fact * i;
}
//Fact
double fxres = 0;
fxres = num / fact;
Console.WriteLine("F(x): " + fxres);
fx+= fxres;
Console.WriteLine("\nSum: " + fx);
number++;