home *** CD-ROM | disk | FTP | other *** search
- /*
- * illustrate the use of math
- * test that strtod called with an overflow-causing positive string
- * returns +HUGE and sets errno to ERANGE
- */
-
- #include <stdlib.h>
- #include <math.h>
- #include <errno.h>
-
- void prt_error (char *);
-
- main()
- {
- char *str2 = "+9e+999";
-
- errno = 0;
- if (strtod (str2, (char **)NULL) != HUGE)
- prt_error ("FAILED, did not return HUGE.");
-
- if (errno != ERANGE)
- prt_error ("FAILED, errno not set to ERANGE.");
-
- }
-
- /* stub for example */
- void
- prt_error (char *arg)
- {
- /*ARGSUSED*/
- }
-