/* nag_bessel_i_nu (s18eec) Example Program.
 *
 * Copyright 2014 Numerical Algorithms Group.
 *
 * NAG C Library
 *
 * Mark 6, 2000.
 */

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

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

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n]");
  printf("nag_bessel_i_nu (s18eec) Example Program Results\n");
  printf("  x      nu        y\n");
  while (scanf("%lf %ld%*[^\n]", &x, &nu) != EOF)
    {
      /* nag_bessel_i_nu (s18eec).
       * Modified Bessel function I_(nu/4)(x)
       */
      y = nag_bessel_i_nu(x, nu, &fail);
      if (fail.code != NE_NOERROR)
        {
          printf("Error from nag_bessel_i_nu (s18eec).\n%s\n",
                  fail.message);
          exit_status = 1;
          goto END;
        }
      printf("%4.1f %6ld %13.4e\n", x, nu, y);
    }
 END:
  return exit_status;
}                               /* main */