/* nag_prob_studentized_range (g01emc) Example Program. * * Copyright 2001 Numerical Algorithms Group. * * Mark 7, 2001. * Mark 7b revised, 2004. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; /* Scalars */ Integer exit_status = 0; double q, v, valp; Integer i, ir; NagError fail; INIT_FAIL(fail); /* Check for command-line IO options */ fpin = nag_example_file_io(argc, argv, "-data", NULL); fpout = nag_example_file_io(argc, argv, "-results", NULL); fprintf(fpout, "nag_prob_studentized_range (g01emc) Example Program Results\n"); /* Skip heading in data file */ fscanf(fpin, "%*[^\n] "); fprintf(fpout, "\n%s\n\n", " q v ir Quantile "); for (i = 1; i <= 3; ++i) { fscanf(fpin, "%lf%lf%ld%*[^\n] ", &q, &v, &ir); /* nag_prob_studentized_range (g01emc). * Computes probability for the Studentized range statistic */ valp = nag_prob_studentized_range(q, v, ir, &fail); if (fail.code != NE_NOERROR) { fprintf(fpout, "Error from nag_prob_studentized_range (g01emc).\n%s\n", fail.message); exit_status = 1; goto END; } fprintf(fpout, "%7.4f%2s%4.1f%1s%3ld%1s%10.4f\n", q, "", v, "", ir, "", valp); } END: if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }