home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / LATTIC_3.LZH / SRC / CXFPE.C < prev    next >
C/C++ Source or Header  |  1990-03-07  |  815b  |  44 lines

  1. /***
  2. *
  3. *          Copyright ⌐ 1989  Lattice, Inc.
  4. *
  5. * name             _CXFPE -- low-level floating point error handler 
  6. *
  7. * synopsis         _CXFPE(sig);
  8. *                  int sig;          signal number
  9. *
  10. * description      This function is the default function to be called
  11. *                  when the SIGFPE signal has been raised.  It sets
  12. *                  errno appropriately.
  13. *
  14. ***/
  15.  
  16. #include <signal.h>
  17. #include <math.h>
  18. #include <errno.h>
  19.  
  20.  
  21. extern void _CXFPE(int);
  22.  
  23. extern int _FPERR;
  24.  
  25.  
  26.  
  27. void _CXFPE(sig)
  28.     int sig;
  29. {
  30.     switch(_FPERR) {
  31.         case FPEUND:
  32.         case FPEOVF:
  33.         case FPEZDV:
  34.             errno = ERANGE;
  35.             break;
  36.         case FPENAN:
  37.         case FPECOM:
  38.             errno = EDOM;
  39.             break;
  40.     }
  41.  
  42.     return;
  43. }
  44.