code: public static double quantile(double val, double mu, double sigma, double xi) {
      if(val < 0.0 || val > 1.0) {
        return Double.NaN;
      }
      if(xi == 0.) {
        return mu - sigma * FastMath.log(1 - val);
      }
      return mu - sigma / xi * (1 - FastMath.pow(1 - val, -xi));
    }
docs: Quantile function of GPD distribution
  
  @param val Value
  @param mu Location parameter mu
  @param sigma Scale parameter sigma
  @param xi Shape parameter xi (= -kappa)
  @return Quantile function at position x.