NAG Library Manual, Mark 30.1
Interfaces:  FL   CL   CPP   AD 

NAG CL Interface Introduction
Example description
/* nag_bessel_k_nu_scaled (s18edc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * NAG C Library
 *
 * Mark 30.1, 2024.
 */

#include <nag.h>
#include <stdio.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_k_nu_scaled (s18edc) Example Program Results\n");
  printf("\n  x      nu        y\n");
  while (scanf("%lf %" NAG_IFMT "%*[^\n]", &x, &nu) != EOF)
  {
    /* nag_bessel_k_nu_scaled (s18edc).
     * Scaled modified Bessel function exp(x) K_(nu/4)(x)
     */
    y = nag_bessel_k_nu_scaled(x, nu, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_bessel_k_nu_scaled (s18edc).\n%s\n", fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%4.1f %6" NAG_IFMT " %13.4e\n", x, nu, y);
  }

END:
  return exit_status;
}