/* nag_elliptic_integral_rc (s21bac) Example Program.
 *
 * Copyright 2014 Numerical Algorithms Group.
 *
 * Mark 2 revised, 1992.
 */

#include <nag.h>
#include <stdio.h>
#include <nag_stdlib.h>
#include <nags.h>

int main(void)
{
  Integer  exit_status = 0;
  double   rc, x, y;
  Integer  ix;
  NagError fail;

  INIT_FAIL(fail);

  printf("nag_elliptic_integral_rc (s21bac) Example Program Results\n");
  printf("     x      y       nag_elliptic_integral_rc (s21bac)  \n");
  for (ix = 1; ix <= 3; ix++)
    {
      x = ix*0.5;
      y = 1.0;
      /* nag_elliptic_integral_rc (s21bac).
       * Degenerate symmetrised elliptic integral of 1st kind
       * R_C(xy)
       */
      rc = nag_elliptic_integral_rc(x, y, &fail);
      if (fail.code != NE_NOERROR)
        {
          printf("Error from nag_elliptic_integral_rc (s21bac).\n%s\n",
                  fail.message);
          exit_status = 1;
          goto END;
        }
      printf("%7.2f%7.2f%12.4f\n", x, y, rc);
    }

 END:
  return exit_status;
}