/* $OpenBSD: strtodtest.c,v 1.1 2006/09/29 11:00:24 otto Exp $ */ /* Public domain, Otto Moerbeek , 2006. */ #include #include #include /* * 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); }