code: function dnbinom(size, prob, logp) {
        logp = logp === true;
  
        if (utils.hasNaN(prob, size) || prob <= 0 || prob > 1 || size < 0) {
          return function(x) { return NaN; };
        }
  
        return function(x) {
           var p, ans;
  
           if (utils.hasNaN(x)) { return NaN; }
           if (x < 0 || x !== Math.floor(x) ||
               utils.isInfinite(x)) {
              return logp ? -Infinity : 0;
           }
           if (x === 0 && size === 0) { return logp ? 0 : 1; }
           if (utils.isInfinite(size)) { size = Number.MAX_VALUE; }
  
           ans = dbinomLog(x + size, prob)(size);
           p = size / (size + x);
  
           return logp ? Math.log(p) + ans : p * Math.exp(ans);
        };
     }
docs: Evaluates the negative binomial distribution's probability mass function
  at `x`, where $x \geq 0$.
  
  `size` must be strictly positive, and `prob` must be in `(0, 1]`.
  
  `logp` defaults to `false`; if `logp` is `true`, returns the
  logarithm of the result.
  
  Adapted from dnbinom.c in R's code.
  
  @fullName dnbinom(size, prob, logp)(x)
  @memberof nbinom