NAG Library Manual, Mark 30.1
Interfaces:  FL   CL   CPP   AD 

NAG CL Interface Introduction
Example description
/* nag_stat_prob_kolmogorov1 (g01eyc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.1, 2024.
 */

#include <nag.h>
#include <stdio.h>

int main(void) {

  /* Scalars */
  double d__, prob;
  Integer exit_status, n;
  NagError fail;

  INIT_FAIL(fail);

  exit_status = 0;
  printf("nag_stat_prob_kolmogorov1 (g01eyc) Example Program Results\n\n");
  printf("%s\n\n", "    d       n    One-sided probability");

  /* Skip heading in data file */
  scanf("%*[^\n] ");
  while (scanf("%" NAG_IFMT " %lf%*[^\n] ", &n, &d__) != EOF)
  {
    /* nag_stat_prob_kolmogorov1 (g01eyc).
     * Computes probabilities for the one-sample
     * Kolmogorov-Smirnov distribution
     */
    prob = nag_stat_prob_kolmogorov1(n, d__, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_stat_prob_kolmogorov1 (g01eyc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.4f%2s%4" NAG_IFMT "%10s%7.4f\n", d__, "", n, "", prob);
  }
END:
  return exit_status;
}