/* nag_elliptic_integral_rf (s21bbc) Example Program.
 *
 * Copyright 2014 Numerical Algorithms Group.
 *
 * Mark 2 revised, 1992.
 *
 * Mark 3 revised, 1994.
 */

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

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

  INIT_FAIL(fail);

  printf("nag_elliptic_integral_rf (s21bbc) Example Program Results\n");
  printf("     x      y      z       nag_elliptic_integral_rf\n");
  for (ix = 1; ix <= 3; ix++)
    {
      x = ix*0.5;
      y = (ix+1)*0.5;
      z = (ix+2)*0.5;
      /* nag_elliptic_integral_rf (s21bbc).
       * Symmetrised elliptic integral of 1st kind R_F(xyz)
       */
      rf = nag_elliptic_integral_rf(x, y, z, &fail);
      if (fail.code != NE_NOERROR)
        {
          printf("Error from nag_elliptic_integral_rf (s21bbc).\n%s\n",
                  fail.message);
          exit_status = 1;
          goto END;
        }
      printf("%7.2f%7.2f%7.2f%12.4f\n", x, y, z, rf);
    }

 END:
  return exit_status;
}