jstat/jstat — comment on commit 345da02d3e4919f9d996d1e5418647ed776904dc
File: src/distribution.js line 491
By richarddmorey:

If you compute the density in logs, you can use much higher values of Y and N. The way the code was written, without logs, it craps out in the hundreds, making it worthless for any real work. When p=0 or p=1, you get a situation where the density function includes 0^0. This is not a problem, because javascript defines this as 1. But when you take the log, you get 0 * log(0), which is undefined. So you need to catch that special case before you compute the density.