/* nag_complex_log_gamma (s14agc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include int main(void) { Complex y, z; Integer exit_status = EXIT_SUCCESS; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("nag_complex_log_gamma (s14agc) Example Program Results\n"); Vprintf(" z ln(Gamma(z))\n"); while (scanf(" (%lf,%lf)%*[^\n] ", &z.re, &z.im) != EOF) { /* nag_complex_log_gamma (s14agc). * Logarithm of the Gamma function ln~Gamma~(z) */ y = nag_complex_log_gamma(z, &fail); if (fail.code == NE_NOERROR) Vprintf("(%5.1f,%5.1f) (%12.4e,%12.4e)\n", z.re, z.im, y.re, y.im); else { Vprintf("Error from nag_complex_log_gamma (s14agc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }