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

NAG CL Interface Introduction
Example description
/* nag_specfun_airy_ai_complex (s17dgc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.1, 2024.
 */

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

int main(void) {
  Integer exit_status = 0;
  Complex z, ai;
  Integer nz;
  char nag_enum_deriv[40], nag_enum_scal[40];
  Nag_ScaleResType scal;
  Nag_FunType deriv;
  NagError fail;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n]");
  printf("nag_specfun_airy_ai_complex (s17dgc) Example Program Results\n");
  printf("    deriv               z              scal                "
         "ai        nz\n");
  while (scanf(" %39s (%lf,%lf) %39s%*[^\n] ", nag_enum_deriv, &z.re, &z.im,
               nag_enum_scal) != EOF) {
    /* nag_enum_name_to_value (x04nac).
     * Converts NAG enum member name to value
     */
    deriv = (Nag_FunType)nag_enum_name_to_value(nag_enum_deriv);
    scal = (Nag_ScaleResType)nag_enum_name_to_value(nag_enum_scal);

    /* nag_specfun_airy_ai_complex (s17dgc).
     * Airy functions Ai(z), complex z
     */
    nag_specfun_airy_ai_complex(deriv, z, scal, &ai, &nz, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_specfun_airy_ai_complex (s17dgc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf(" %-12s  (%7.3f,%7.3f)  %-14s  (%7.3f,%7.3f)  %" NAG_IFMT "\n",
           nag_enum_deriv, z.re, z.im, nag_enum_scal, ai.re, ai.im, nz);
  }

END:

  return exit_status;
}