code: function qhelper(lowerTail, logp, xmin, xmax, f) {
           return logp ? function(p) {
              return p === -Infinity ? lowerTail ? xmin : xmax
                   : p === 0 ? lowerTail ? xmax : xmin
                   : p < 0 ? f(p) : NaN;
           } : function(p) {
              return p === 0 ? lowerTail ? xmin : xmax
                       : p === 1 ? lowerTail ? xmax : xmin
                       : p > 0 && p < 1 ? f(p) : NaN;
           };
        }
docs: /*
  qhelper
  helper for quantile functions, to handle out-of-range cases
  
  Takes `logp` and a function `f`.
  Returns a function of `p` which checks that `p` is a valid probability
  in the logp space before passing `p` to `f`.
  
  The returned function returns NaN if the probability represented by `p` is out
  of range.