Computing the Two-Sided Kolmogorov-Smirnov Distribution

We propose an algorithm to compute the cumulative distribution function of the two-sided Kolmogorov-Smirnov test statistic Dn and its complementary distribution in a fast and reliable way. Different approximations are used in different regions of n, x. Java and C programs are available.