home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / before / ieeemath.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  522 b   |  32 lines

  1. /*
  2.  * illustrate the use of math
  3.  * test that strtod called with an overflow-causing positive string
  4.  * returns +HUGE and sets errno to ERANGE
  5.  */
  6.  
  7. #include <stdlib.h>
  8. #include <math.h>
  9. #include <errno.h>
  10.  
  11. void prt_error (char *);
  12.  
  13. main()
  14. {
  15.     char *str2 = "+9e+999";
  16.  
  17.     errno = 0;
  18.     if (strtod (str2, (char **)NULL) != HUGE)
  19.         prt_error ("FAILED, did not return HUGE.");
  20.  
  21.     if (errno != ERANGE)
  22.         prt_error ("FAILED, errno not set to ERANGE.");
  23.  
  24. }
  25.  
  26. /* stub for example */
  27. void
  28. prt_error (char *arg)
  29. {
  30.     /*ARGSUSED*/
  31. }
  32.