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

NAG CL Interface Introduction
Example description
/* nag_specfun_ellipint_complete_2 (s21bjc) Example Program.
 *
 * Copyright 2023 Numerical Algorithms Group.
 *
 * Mark 29.0, 2023.
 */
/* Pre-processor includes */
#include <nag.h>
#include <stdio.h>

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

  INIT_FAIL(fail);

  printf("%s\n",
         "nag_specfun_ellipint_complete_2 (s21bjc) Example Program Results");
  printf("\n");
  printf("%s\n", "    dm       nag_specfun_ellipint_complete_2");
  printf("\n");
  for (ix = 1; ix <= 3; ix++) {
    dm = ix * 0.250e0;
    /*
     * nag_specfun_ellipint_complete_2 (s21bjc)
     * Complete elliptic integral of 2nd kind, Legendre form, E(m)
     */
    E = nag_specfun_ellipint_complete_2(dm, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from "
             "nag_specfun_ellipint_complete_2 (s21bjc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.2f%12.4f\n", dm, E);
  }

END:

  return exit_status;
}