/* nag_specfun_gamma_incomplete (s14bac) Example Program.
*
* Copyright 2024 Numerical Algorithms Group.
*
* Mark 30.3, 2024.
*/
#include <nag.h>
#include <stdio.h>
int main(void) {
Integer exit_status = 0;
double a, p, q, tol, x;
NagError fail;
INIT_FAIL(fail);
/* Skip heading in data file */
scanf("%*[^\n]");
printf("nag_specfun_gamma_incomplete (s14bac) Example Program Results\n");
/* nag_machine_precision (x02ajc).
* The machine precision
*/
tol = nag_machine_precision;
printf(" a x p q\n");
while (scanf("%lf %lf", &a, &x) != EOF)
{
/* nag_specfun_gamma_incomplete (s14bac).
* Incomplete Gamma functions P(ax) and Q(ax)
*/
nag_specfun_gamma_incomplete(a, x, tol, &p, &q, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_specfun_gamma_incomplete (s14bac).\n%s\n",
fail.message);
exit_status = 1;
goto END;
}
printf("%12.4f%12.4f%12.4f%12.4f\n", a, x, p, q);
}
END:
return exit_status;
}