public static double cdf(double x,double mu,double sigma,boolean log_p){
  if (Double.isNaN(x) || Double.isNaN(mu) || Double.isNaN(sigma)) {
    return Double.NaN;
  }
  if (Double.isInfinite(x) && mu == x) {
    return Double.NaN;
  }
  if (sigma <= 0) {
    if (sigma < 0) {
      return Double.NaN;
    }
    return (x < mu) ? 0.0 : 1.0;
  }
  double p=(x - mu) / sigma;
  if (Double.isInfinite(p)) {
    return (x < mu) ? 0.0 : 1.0;
  }
  return standardCDF(p,log_p);
}

public static double cdf ( double x , double mu , double sigma , boolean log_p ) { if ( Double . isNaN ( x ) || Double . isNaN ( mu ) || Double . isNaN ( sigma ) ) { return Double . NaN ; } if ( Double . isInfinite ( x ) && mu == x ) { return Double . NaN ; } if ( sigma <= 0 ) { if ( sigma < 0 ) { return Double . NaN ; } return ( x < mu ) ? 0.0 : 1.0 ; } double p = ( x - mu ) / sigma ; if ( Double . isInfinite ( p ) ) { return ( x < mu ) ? 0.0 : 1.0 ; } return standardCDF ( p , log_p ) ; }
a more accurate and faster implementation of the cdf ( taken from function pnorm in the r statistical language ) this implementation has discrepancies depending on the programming language and system architecture in java , returned values become zero once z reaches - 37 . 5193 exactly on the machine tested in the other implementation , the returned value 0 at about z = - 8 in c , this 0 value is reached approximately z = - 37 . 51938 < p / > will later need to be optimised for beast
