code: public static double HighAccuracyFunction(double x) {
          if (x < -8 || x > 8)
              return 0;
  
          double sum = x;
          double term = 0;
  
          double nextTerm = x;
          double pwr = x * x;
          double i = 1;
  
          // Iterate until adding next terms doesn't produce
          // any change within the current numerical accuracy.
  
          while (sum != term) {
              term = sum;
  
              // Next term
              nextTerm *= pwr / (i += 2);
  
              sum += nextTerm;
          }
  
          return 0.5 + sum * Math.exp(-0.5 * pwr - 0.5 * Constants.Log2PI);
      }
docs: High-accuracy Normal cumulative distribution function.
  
  @param x Value.
  @return Result.