code: function ptlog(df, lowerTail) {
        return function(x) {
           var val;
  
           if (utils.hasNaN(x, df) || df <= 0) { return NaN; }
           val = df > x * x ?
                 bratio(0.5, df / 2, x * x / (df + x * x), false, true)
               : bratio(df / 2, 0.5, 1 / (1 + x / df * x), true, true);
  
           if (x <= 0) { lowerTail = !lowerTail; }
  
           return lowerTail ? log1p(-0.5 * Math.exp(val))
                            : val - Math.log(2);
        };
     }
docs: cumulative distribution function, log version based on pt.c from R implementation