xref: /openbsd-src/regress/lib/libc/strtod/strtodtest.c (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 /*	$OpenBSD: strtodtest.c,v 1.1 2006/09/29 11:00:24 otto Exp $	*/
2 /* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <errno.h>
7 
8 /*
9  * Checks if strtod() reports underflow.
10  */
11 
12 int
13 main()
14 {
15 	char *tmp="0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002";
16 	double d;
17 
18 	d = strtod(tmp, NULL);
19 	if (errno != ERANGE)
20 		errx(1, "errno = %d", errno);
21 	return (0);
22 }
23