home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / sep91.zip / 9N09014A < prev    next >
Text File  |  1991-08-06  |  492b  |  24 lines

  1. /* exp function */
  2. #include "xmath.h"
  3.  
  4. double (exp)(double x)
  5.     {   /* compute exp(x) */
  6.     switch (_Dtest(&x))
  7.         {   /* test for special codes */
  8.     case NAN:
  9.         errno = EDOM;
  10.         return (x);
  11.     case INF:
  12.         errno = ERANGE;
  13.         return (DSIGN(x) ? 0.0 : _Inf._D);
  14.     case 0:
  15.         return (1.0);
  16.     default:    /* finite */
  17.         if (0 <= _Exp(&x, 0))
  18.             errno = ERANGE;
  19.         return (x);
  20.         }
  21.     }
  22. /* End of File */
  23.  
  24.