home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_04 / 8n04031a < prev    next >
Text File  |  1990-03-20  |  576b  |  29 lines

  1. *****Listing 3*****
  2.  
  3.  
  4. #include <math.h>    /* get struct */
  5.  
  6. int matherr(struct exception *pe)
  7. {
  8.     int retval = 1;    /* assume we'll recover */
  9.  
  10.     printf("Function %s failed with error type ", pe->name);
  11.     if (pe->type == DOMAIN)
  12.         printf("DOMAIN\n");
  13.     else if (pe->type == SING)
  14.         printf("SING\n");
  15.     else if (pe->type == OVERFLOW)
  16.         printf("OVERFLOW\n");
  17.     else if (pe->type == UNDERFLOW)
  18.         printf("UNDERFLOW\n");
  19.     else if (pe->type == TLOSS)
  20.         printf("TLOSS\n");
  21.     else {
  22.         printf("UNKNOWN\n");
  23.         retval = 0;    /* can't handle here */
  24.     }
  25.  
  26.     return retval;
  27. }
  28.  
  29.