/* nag_deviates_studentized_range (g01fmc) Example Program. * * Copyright 2001 Numerical Algorithms Group. * * Mark 7, 2001. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; /* Scalars */ double p, v, valq; Integer exit_status, i__, ir; NagError fail; exit_status = 0; 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_deviates_studentized_range (g01fmc) Example Program Results\n"); /* Skip heading in data file */ fscanf(fpin, "%*[^\n] "); fprintf(fpout, "\n%s\n\n", " p v ir Quantile "); for (i__ = 1; i__ <= 3; ++i__) { fscanf(fpin, "%lf%lf%ld%*[^\n] ", &p, &v, &ir); /* nag_deviates_studentized_range (g01fmc). * Computes deviates for the Studentized range statistic */ valq = nag_deviates_studentized_range(p, v, ir, &fail); if (fail.code == NE_NOERROR || fail.code == NE_ACCURACY) { fprintf(fpout, "%5.2f%2s%4.1f%1s%3ld%1s%10.4f\n", p, "", v, "", ir, "", valq); } else { fprintf(fpout, "Error from nag_deviates_studentized_range (g01fmc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }