code: public static double logNormalDistribution(double sigma, double x) {
          return Math.log(1.0 / (sqrt(2.0 * PI) * sigma)) + (-0.5 * pow(x / sigma, 2));
      }
docs: Use this function instead of Math.log(normalDistribution(sigma, x)) to avoid an
  arithmetic underflow for very small probabilities.