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

NAG CL Interface Introduction
Example description
/* nag_specfun_erfc_complex (s15ddc) Example Program.
 *
 * Copyright 2022 Numerical Algorithms Group.
 *
 * Mark 28.3, 2022.
 */

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

int main(void) {
  Integer exit_status = 0;
  Complex w, z;
  NagError fail;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n]");
  printf("nag_specfun_erfc_complex (s15ddc) Example Program Results\n");
  printf("          z                     w\n");
  while (scanf(" (%lf,%lf)%*[^\n] ", &z.re, &z.im) != EOF)
  {
    /* nag_specfun_erfc_complex (s15ddc).
     * Scaled complex complement of error function,
     * exp(-z^2)erfc(-iz)
     */
    w = nag_specfun_erfc_complex(z, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_specfun_erfc_complex (s15ddc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("(%8.4f,%8.4f)   (%8.4f,%8.4f)\n", z.re, z.im, w.re, w.im);
  }

END:

  return exit_status;
}