docs: function dbeta(a, b, logp) {
        logp = logp === true;
  
        /* eslint-disable complexity */
        return function(x) {
           var lb, p, n, alogx, blogmx;
  
           if (utils.hasNaN(x, a, b) || a < 0 || b < 0) { return NaN; }
           if (x < 0 || x > 1) {
              lb = -Infinity;
           } else if (a === 0 && b === 0) { // point mass 1/2 at each of {0,1} :
              lb = x === 0 || x === 1 ? Infinity : -Infinity;
           } else if (a === Infinity && b === Infinity) {
              lb = x === 0.5 ? Infinity : -Infinity; // point mass 1 at 1/2
           } else if (a / b === 0) { // a=0 or b=Inf. point mass 1 at 0
              lb = x === 0 ? Infinity : -Infinity;
           } else if (b / a === 0) { // b=0 or a=Inf. point mass 1 at 1
              lb = x === 1 ? Infinity : -Infinity;
           } else if (a <= 2 || b <= 2) {
              // Direct beta calculation
              alogx = a === 1 && x === 0 ? 0 : (a - 1) * Math.log(x);
              blogmx = b === 1 && x === 1 ? 0 : (b - 1) * log1p(-x);
              lb = alogx + blogmx - lbeta(a, b);
           } else {
              p = x;
              x = a - 1;
              n = a + b - 2;
              lb = Math.log(a + b - 1) + dbinomLog(n, p)(x);
           }
           return logp ? lb : Math.exp(lb);
        };
        /* eslint-enable complexity */
     }