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

NAG CL Interface Introduction
Example description
/* nag_specfun_ellipint_complete_1 (s21bhc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.1, 2024.
 */
/* 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, k;
  NagError fail;

  INIT_FAIL(fail);

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

END:

  return exit_status;
}