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

NAG CL Interface Introduction
Example description
/* nag_stat_inv_cdf_f (g01fdc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.2, 2024.
 */

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

int main(void) {
  Integer exit_status = 0;
  double df1, df2, f, p;
  NagError fail;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n]");
  printf("nag_stat_inv_cdf_f (g01fdc) Example Program Results\n");
  printf("     p      df1     df2      f\n\n");
  while (scanf("%lf %lf %lf", &p, &df1, &df2) != EOF)
  {
    /* nag_stat_inv_cdf_f (g01fdc).
     * Deviates for the F-distribution
     */
    f = nag_stat_inv_cdf_f(p, df1, df2, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_stat_inv_cdf_f (g01fdc).\n%s\n", fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%8.3f%8.3f%8.3f%8.3f\n", p, df1, df2, f);
  }

END:
  return exit_status;
}