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

NAG CL Interface Introduction
Example description
/* nag_error_name_to_code (x04ncc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.0, 2024.
 */

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

int main(void) {
  /* Scalars */
  Integer exit_status = 0;
  int ierror;
  /* Pointers */
  const char *str_error;

  printf("nag_error_name_to_code (x04ncc) Example Program Results\n\n");

  /* Print header. */
  printf("   Error name     Value Returned Value\n");
  printf("----------------- ----- --------------\n");

  /* Convert the error strings to values and print. */

  str_error = "NE_BAD_PARAM";
  /* nag_error_name_to_code (x04ncc).
   * Converts NAG error name to its code value
   */
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_BAD_PARAM, ierror);

  str_error = "NE_INCOMPAT_PARAM";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_INCOMPAT_PARAM, ierror);

  str_error = "NE_COMPLEX_ZERO";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_COMPLEX_ZERO, ierror);

  str_error = "NE_NOT_MONOTONIC";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_NOT_MONOTONIC, ierror);

  str_error = "NE_TOO_MANY_ITER";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_TOO_MANY_ITER, ierror);

  str_error = "NE_SINGULAR";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_SINGULAR, ierror);

  str_error = "NE_INITIALIZATION";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_INITIALIZATION, ierror);

  return exit_status;
}