Example description
/* nag_specfun_hyperg_confl_real (s22bac) Example Program.
 *
 * Copyright 2019 Numerical Algorithms Group.
 *
 * Mark 27.0, 2019.
 */

#include <stdio.h>
#include <string.h>
#include <nag.h>

void construct_table(double a, double b);

int main(void)
{
  /* Scalars */
  Integer exit_status = 0;
  Integer kx;
  double a, b, m, x;
  /* Nag Types */
  NagError fail;

  INIT_FAIL(fail);

  printf("nag_specfun_hyperg_confl_real (s22bac) Example Program Results\n\n");

  a = 13.6;
  b = 14.2;

  construct_table(a, b);

  for (kx = -5; kx < 6; kx++) {
    x = (double) kx + 0.5;
    /* Evaluate Real confluent hypergeometric function M(a,b,x) using
     * nag_specfun_hyperg_confl_real (s22bac).
     */
    nag_specfun_hyperg_confl_real(a, b, x, &m, &fail);
    printf("%13.2f  ", x);
    switch (fail.code) {
    case NE_NOERROR:
    case NW_UNDERFLOW_WARN:
    case NW_SOME_PRECISION_LOSS:
      {
        printf("%13.5e\n", m);
        break;
      }
    default:
      {
        printf("No finite or sufficiently accurate result.\n");
        exit_status = 1;
        break;
      }
    }
  }
  return exit_status;
}

void construct_table(double a, double b)
{
  printf("          a              b\n");
  printf("+--------------+--------------+\n");
  printf("%13.2f  %13.2f\n", a, b);
  printf("+--------------+--------------+\n");
  printf("          x        M(a,b,x)\n");
  printf("+--------------+--------------+\n\n");
  return;
}