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

NAG CL Interface Introduction
Example description
/* nag_stat_inv_cdf_studentized_range (g01fmc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.0, 2024.
 */

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

int main(void) {

  /* Scalars */
  double p, v, valq;
  Integer exit_status, i__, ir;
  NagError fail;

  exit_status = 0;

  INIT_FAIL(fail);

  printf(
      "nag_stat_inv_cdf_studentized_range (g01fmc) Example Program Results\n");

  /* Skip heading in data file */
  scanf("%*[^\n] ");

  printf("\n%s\n\n", "  p     v    ir    Quantile ");
  for (i__ = 1; i__ <= 3; ++i__) {
    scanf("%lf%lf%" NAG_IFMT "%*[^\n] ", &p, &v, &ir);

    /* nag_stat_inv_cdf_studentized_range (g01fmc).
     * Computes deviates for the Studentized range statistic
     */
    valq = nag_stat_inv_cdf_studentized_range(p, v, ir, &fail);
    if (fail.code == NE_NOERROR || fail.code == NE_ACCURACY) {
      printf("%5.2f%2s%4.1f%1s%3" NAG_IFMT "%1s%10.4f\n", p, "", v, "", ir, "",
             valq);
    } else {
      printf("Error from nag_stat_inv_cdf_studentized_range (g01fmc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
  }

END:
  return exit_status;
}