<commit_before>/* File altered for inclusion in cephes module for Python:
   Main loop commented out.... */
/*  <NAME> Nov. 1998 */


/* Re Kolmogorov statistics, here is Birnbaum and Tingey's formula for the
   distribution of D+, the maximum of all positive deviations between a
   theoretical distribution function P(x) and an empirical one Sn(x)
   from n samples.

     +
    D  =         sup        [ P(x) - Sn(x) ]
     n     -inf < x < inf


                  [n(1-e)]
        +            -                    v-1              n-v
    Pr{D   > e} =    >    C    e (e + v/n)    (1 - e - v/n)
        n            -   n v
                    v=0

    [n(1-e)] is the largest integer not exceeding n(1-e).
    nCv is the number of combinations of n things taken v at a time.  */


#include "mconf.h"
extern double MAXLOG;

/* Exact Smirnov statistic, for one-sided test.  */
double
smirnov (n, e)
     int n;
     double e;
{
  int v, nn;
  double evn, omevn, p, t, c, lgamnp1;

  if (n <= 0 || e < 0.0 || e > 1.0)
    return (NPY_NAN);
  if (e == 0.0) return 1.0;
  nn = (int) (floor ((double) n * (1.0 - e)));<commit_msg>BUG: special/smirnov -- make comparison robust to handle NaNs<commit_after>/* File altered for inclusion in cephes module for Python:
   Main loop commented out.... */
/*  <NAME> Nov. 1998 */


/* Re Kolmogorov statistics, here is Birnbaum and Tingey's formula for the
   distribution of D+, the maximum of all positive deviations between a
   theoretical distribution function P(x) and an empirical one Sn(x)
   from n samples.

     +
    D  =         sup        [ P(x) - Sn(x) ]
     n     -inf < x < inf


                  [n(1-e)]
        +            -                    v-1              n-v
    Pr{D   > e} =    >    C    e (e + v/n)    (1 - e - v/n)
        n            -   n v
                    v=0

    [n(1-e)] is the largest integer not exceeding n(1-e).
    nCv is the number of combinations of n things taken v at a time.  */


#include "mconf.h"
extern double MAXLOG;

/* Exact Smirnov statistic, for one-sided test.  */
double
smirnov (n, e)
     int n;
     double e;
{
  int v, nn;
  double evn, omevn, p, t, c, lgamnp1;

  /* This comparison should assure returning NaN whenever
     e is NaN itself.  In original || form it would proceed */
  if (!(n > 0 && e >= 0.0 && e <= 1.0))
    return (NPY_NAN);
  if (e == 0.0) return 1.0;
  nn = (int) (floor ((double) n * (1.0 - e)));
{'fraction_non_alphanumeric': 0.12299465240641712, 'fraction_numerical': 0.01809954751131222, 'mean_word_length': 1.6579234972677597, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6180992', 'n_tokens_mistral': 889, 'n_tokens_neox': 828, 'n_words': 317}