Example description
/* nag_specfun_ellipint_legendre_3 (s21bgc) Example Program.
 *
 * Copyright 2019 Numerical Algorithms Group.
 *
 * Mark 27.0, 2019.
 */
/* Pre-processor includes */
#include <stdio.h>
#include <math.h>
#include <nag.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;
}