summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/strtod/strtodtest.c
blob: 0291365a7577f118390ebeb9665affc008514e85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*	$OpenBSD: strtodtest.c,v 1.1 2006/09/29 11:00:24 otto Exp $	*/
/* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

/*
 * Checks if strtod() reports underflow.
 */

int
main()
{
	char *tmp="0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002";
	double d;

	d = strtod(tmp, NULL);
	if (errno != ERANGE)
		errx(1, "errno = %d", errno);
	return (0);
}