twolodzko / extraDistr

Additional univariate and multivariate distributions
51 stars 11 forks source link

rmnom returns NaNs for small probabilities #7

Closed twolodzko closed 7 years ago

twolodzko commented 7 years ago

For very small values of prob parameter, rmnom returns NaNs, e.g.

p <- c(0, 0, 1, 0, 2.77053929981958e-18)
rmnom(1, 100, p)
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    0  100  NaN  NaN

Same with rdirmnom:

rdirmnom(1, 100, p+1e-5)
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    0  100  NaN  NaN