summaryrefslogtreecommitdiff
path: root/regress/lib/libc/strtod/strtodtest.c
blob: 570a002b185e48a34de77e6c26f0b1c7a34422e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*	$OpenBSD: strtodtest.c,v 1.2 2017/02/25 07:28:32 jsg Exp $	*/
/* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <err.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);
}