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

NAG CL Interface Introduction
Example description
/* nag_specfun_ellipint_legendre_3 (s21bgc) Example Program.
 *
 * Copyright 2022 Numerical Algorithms Group.
 *
 * Mark 28.4, 2022.
 */
/* Pre-processor includes */
#include <math.h>
#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, dn, p, phi, pi;
  NagError fail;

  INIT_FAIL(fail);

  printf("nag_specfun_ellipint_legendre_3 (s21bgc) Example Program Results\n");
  printf("\n    dn     phi    dm       nag_specfun_ellipint_legendre_3\n\n");
  /*
   * nag_math_pi (x01aac)
   */
  pi = nag_math_pi;
  for (ix = 1; ix <= 3; ix++) {
    phi = ix * pi / 6.00e0;
    dm = ix * 0.250e0;
    dn = (pow(((-(1.00e0))), (ix + 1))) * ix * 0.10e0;
    /*
     * nag_specfun_ellipint_legendre_3 (s21bgc)
     * Elliptic integral of 3rd kind, Legendre form, Pi (n; phi |m)
     */
    p = nag_specfun_ellipint_legendre_3(dn, phi, dm, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_specfun_ellipint_legendre_3 (s21bgc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.2f%7.2f%7.2f%12.4f\n", dn, phi, dm, p);
  }

END:

  return exit_status;
}