/* nag_stat_prob_f (g01edc) Example Program.
*
* Copyright 2024 Numerical Algorithms Group.
*
* Mark 30.1, 2024.
*/
#include <nag.h>
#include <stdio.h>
int main(void) {
Integer exit_status = 0;
double df1, df2, f, prob;
NagError fail;
INIT_FAIL(fail);
/* Skip heading in data file */
scanf("%*[^\n]");
printf("nag_stat_prob_f (g01edc) Example Program Results\n");
printf(" f df1 df2 prob\n\n");
while (scanf("%lf %lf %lf", &f, &df1, &df2) != EOF)
{
/* nag_stat_prob_f (g01edc).
* Probabilities for F-distribution
*/
prob = nag_stat_prob_f(Nag_LowerTail, f, df1, df2, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_stat_prob_f (g01edc).\n%s\n", fail.message);
exit_status = 1;
goto END;
}
printf("%6.3f%8.3f%8.3f%8.4f\n", f, df1, df2, prob);
}
END:
return exit_status;
}