rodrigosetti / probdist

Probability Distributions in Node JS
MIT License
4 stars 2 forks source link

Binomial Distribution undefined #2

Open oliverdunk opened 8 years ago

oliverdunk commented 8 years ago

Hi,

When doing a binomial estimate using a low chance and large number of trials, such as 3600 trials and a 0.08 probability, the result is undefined.

Any ideas as to if this can be patched?

oliverdunk commented 8 years ago

Looks like "nfactorial" returns Infinity, which could be the issue. Might need to use an alternative method rather than factorials?

rodrigosetti commented 8 years ago

Factorial of 3600 is 2.54... × 10^11241, too big to represent in javascript integer. We could use BigInteger, but a better solution would be a different solution for the binomial probability