/* nag_elliptic_integral_complete_E (s21bjc) Example Program.
 *
 * NAGPRODCODE Version.
 *
 * Copyright 2016 Numerical Algorithms Group.
 *
 * Mark 26, 2016.
 */
/* Pre-processor includes */
#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nags.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_elliptic_integral_complete_E (s21bjc) Example Program Results");
  printf("\n");
  printf("%s\n", "    dm       nag_elliptic_integral_complete_E");
  printf("\n");
  for (ix = 1; ix <= 3; ix++) {
    dm = ix * 0.250e0;
    /*
     * nag_elliptic_integral_complete_E (s21bjc)
     * Complete elliptic integral of 2nd kind, Legendre form, E(m)
     */
    E = nag_elliptic_integral_complete_E(dm, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from "
             "nag_elliptic_integral_complete_E (s21bjc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.2f%12.4f\n", dm, E);
  }

END:

  return exit_status;
}