1 /* $OpenBSD: strtodtest.c,v 1.2 2017/02/25 07:28:32 jsg Exp $ */ 2 /* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */ 3 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <errno.h> 7 #include <err.h> 8 9 /* 10 * Checks if strtod() reports underflow. 11 */ 12 13 int 14 main() 15 { 16 char *tmp="0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002"; 17 double d; 18 19 d = strtod(tmp, NULL); 20 if (errno != ERANGE) 21 errx(1, "errno = %d", errno); 22 return (0); 23 } 24