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

NAG CL Interface Introduction
Example description
/* nag_specfun_ellipint_general_2 (s21dac) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * NAG C Library
 *
 * Mark 30.1, 2024.
 */

#include <stdio.h>

#include <nag.h>

int main(void) {
  Complex y, z;
  Integer exit_status = 0;
  NagError fail;
  double a, akp, b;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n] ");
  printf("nag_specfun_ellipint_general_2 (s21dac) Example Program "
         "Results\n");
  printf("      z          akp      a       b                 y\n");
  while (scanf(" (%lf,%lf) %lf %lf %lf%*[^\n] ", &z.re, &z.im, &akp, &a, &b) !=
         EOF) {
    /* nag_specfun_ellipint_general_2 (s21dac).
     * Elliptic integrals of the second kind with complex
     * arguments
     */
    y = nag_specfun_ellipint_general_2(z, akp, a, b, &fail);
    if (fail.code == NE_NOERROR)
      printf("(%4.1f, %4.1f) %7.1f %7.1f %7.1f  (%13.4e, %13.4e)\n", z.re, z.im,
             akp, a, b, y.re, y.im);
    else {
      printf("Error from nag_specfun_ellipint_general_2 (s21dac)."
             "\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
  }
END:
  return exit_status;
}