def logCdfNormal(z):
    """
    Robust implementations of log cdf of a standard normal.

     @see [[https://github.com/mseeger/apbsint/blob/master/src/eptools/potentials/SpecfunServices.h original implementation]]
     in C from Matthias Seeger.
    """
    if (abs(z) < ERF_CODY_LIMIT1):
        # Phi(z) approx  (1+y R_3(y^2))/2, y=z/sqrt(2)
        return np.log1p((z / M_SQRT2) * _erfRationalHelperR3(0.5 * z * z)) - M_LN2
    elif (z < 0.0):
        # Phi(z) approx N(z)Q(-z)/(-z), z<0
        return logPdfNormal(z) - np.log(-z) + np.log(_erfRationalHelper(-z))
    else:
        return np.log1p(-(np.exp(logPdfNormal(z))) * _erfRationalHelper(z) / z)
Robust implementations of log cdf of a standard normal.

     @see [[https://github.com/mseeger/apbsint/blob/master/src/eptools/potentials/SpecfunServices.h original implementation]]
     in C from Matthias Seeger.