#include <math.h> /* get struct */
int matherr(struct exception *pe)
{
int retval = 1; /* assume we'll recover */
printf("Function %s failed with error type ", pe->name);
if (pe->type == DOMAIN)
printf("DOMAIN\n");
else if (pe->type == SING)
printf("SING\n");
else if (pe->type == OVERFLOW)
printf("OVERFLOW\n");
else if (pe->type == UNDERFLOW)
printf("UNDERFLOW\n");
else if (pe->type == TLOSS)
printf("TLOSS\n");
else {
printf("UNKNOWN\n");
retval = 0; /* can't handle here */
}
return retval;
}