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

  1.  
  2. *****Listing 1*****
  3.  
  4. #include <stdio.h>
  5. #include <errno.h>
  6. #include <math.h>
  7.  
  8. main()
  9. {
  10.     double d;
  11.  
  12.     errno = 0;
  13.     d = sqrt(10);
  14.     if (errno == EDOM)
  15.         printf("#1 domain error\n");
  16.     else
  17.         printf("#1 OK\n");
  18.  
  19.     errno = 0;
  20.     d = sqrt(-10);
  21.     if (errno == EDOM)
  22.         printf("#2 domain error\n");
  23.     else
  24.         printf("#2 OK\n");
  25. }
  26.  
  27. #1 OK
  28. #2 domain error
  29.  
  30.