code: protected static double gammaCdf(double x, double a) {
          if(x<0) {
              throw new IllegalArgumentException("The x parameter must be positive.");
          }
          
          double GI;
          if (a>200) {
              double z=(x-a)/Math.sqrt(a);
              double y=gaussCdf(z);
              double b1=2/Math.sqrt(a);
              double phiz=0.39894228*Math.exp(-z*z/2);
              double w=y-b1*(z*z-1)*phiz/6;  //Edgeworth1
              double b2=6/a;
              int zXor4=((int)z)^4;
              double u=3*b2*(z*z-3)+b1*b1*(zXor4-10*z*z+15);
              GI=w-phiz*z*u/72;        //Edgeworth2
          } 
          else if (x<a+1) {
              GI=gSer(x,a);
          } 
          else {
              GI=gCf(x,a);
          }
          
          return GI;
      }
docs: Internal function used by gammaCdf
  
  @param x
  @param a
  @return