/* nag_stat_inv_cdf_normal (g01fac) Example Program.
*
* Copyright 2021 Numerical Algorithms Group.
*
* Mark 27.2, 2021.
*
*/
#include <nag.h>
#include <stdio.h>
int main(void) {
Integer exit_status = 0;
double p;
double dev;
Integer i;
char nag_enum_arg[40];
Nag_TailProbability tail;
NagError fail;
INIT_FAIL(fail);
printf("nag_stat_inv_cdf_normal (g01fac) Example Program Results\n");
/* Skip heading in data file */
scanf("%*[^\n] ");
printf("\n Tail Probability Deviate \n\n");
for (i = 1; i <= 4; ++i) {
scanf("%39s %lf ", nag_enum_arg, &p);
/* nag_enum_name_to_value (x04nac).
* Converts NAG enum member name to value
*/
tail = (Nag_TailProbability)nag_enum_name_to_value(nag_enum_arg);
/* nag_stat_inv_cdf_normal (g01fac).
* Deviates for the Normal distribution
*/
dev = nag_stat_inv_cdf_normal(tail, p, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_stat_inv_cdf_normal (g01fac).\n%s\n",
fail.message);
exit_status = 1;
goto END;
}
printf(" %-17s %5.3f %6.4f\n", nag_enum_arg, p, dev);
}
END:
return exit_status;
}