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

NAG CL Interface Introduction
Example description
/* nag_specfun_gamma_log_scaled_real (s14ahc) Example Program.
 *
 * Copyright 2022 Numerical Algorithms Group.
 *
 * Mark 28.3, 2022.
 */
/* Pre-processor includes */
#include <nag.h>
#include <stdio.h>

int main(void) {
  /*Integer scalar and array declarations */
  Integer exit_status = 0;
  /*Double scalar and array declarations */
  double x, y;
  NagError fail;

  INIT_FAIL(fail);

  printf(
      "nag_specfun_gamma_log_scaled_real (s14ahc) Example Program Results\n");
  /* Skip heading in data file */
  scanf("%*[^\n] ");
  printf("\n%s\n\n", "       x          y");
  while (scanf("%lf%*[^\n] ", &x) != EOF)
  {
    /*
     * nag_specfun_gamma_log_scaled_real (s14ahc)
     * Scaled logarithm of Gamma function, G(x)
     */
    y = nag_specfun_gamma_log_scaled_real(x, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_specfun_gamma_log_scaled_real (s14ahc) %s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%14.5e%14.5e\n", x, y);
  }

END:
  return exit_status;
}