code: function invErfc(p) {
    if (p < 0.0 || p > 2.0) {
      throw RangeError('Argument must be betweeen 0 and 2');
    }
  
    else if (p === 0.0) {
      return Infinity;
    }
    
    else if (p === 2.0) {
      return -Infinity;
    }
    
    else {
      var pp = p < 1.0 ? p : 2.0 - p;
      var t = Math.sqrt(-2.0 * Math.log(pp / 2.0));
      var x = -0.70711 * ((2.30753 + t * 0.27061) / (1.0 + t * (0.99229 + t * 0.04481)) - t);
  
      var err1 = erfc(x) - pp;
      x += err1 / (M_2_SQRTPI * Math.exp(-x * x) - x * err1);
      var err2 = erfc(x) - pp;
      x += err2 / (M_2_SQRTPI * Math.exp(-x * x) - x * err2);
  
      return p < 1.0 ? x : -x;
    }
  }
docs: Combined from three sources: Python: http://pydoc.net/Python/timbre/1.0.0/timbre.stats/ JavaScript: https://github.com/jstat/jstat/blob/master/src/special.js C: https://github.com/Peteysoft/sea_ice/blob/master/src/mcc_ice/inverf.c