public double erf(double z){
  double sign=Math.signum(z);
  z=Math.abs(z);
  double a1=0.278393, a2=0.230389, a3=0.000972, a4=0.078108;
  double sumterm=1 + a1 * z + a2 * Math.pow(z,2) + a3 * Math.pow(z,3) + a4 * Math.pow(z,4);
  return sign * (1 - 1 / (Math.pow(sumterm,4)));
}

public double erf ( double z ) { double sign = Math . signum ( z ) ; z = Math . abs ( z ) ; double a1 = 0.278393 , a2 = 0.230389 , a3 = 0.000972 , a4 = 0.078108 ; double sumterm = 1 + a1 * z + a2 * Math . pow ( z , 2 ) + a3 * Math . pow ( z , 3 ) + a4 * Math . pow ( z , 4 ) ; return sign * ( 1 - 1 / ( Math . pow ( sumterm , 4 ) ) ) ; }
approximation of error function , equation 7 . 1 . 27 from abramowitz , m . and stegun , i . a . ( eds . ) . " repeated integrals of the error function . " s 7 . 2 in handbook of mathematical functions with formulas , graphs , and mathematical tables , 9th printing . new york : dover , pp . 299 - 300 , 1972 . error of approximation < = 5 * 10 ^ - 4
