From: Eric Blake Date: Fri, 4 Apr 2008 04:37:49 +0000 (-0600) Subject: Improve strtod bug detection check. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c466f0ea2edfa1ffa0b509fd8cc2287414b0dab;p=pspp Improve strtod bug detection check. * m4/strtod.m4 (gl_FUNC_STRTOD): Also check for hex-float parsing, required for Solaris 10. Reported by Bob Friesenhahn and Nelson H. F. Beebe. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 950a574e83..a1a3041ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-04-04 Eric Blake + + Improve strtod bug detection check. + * m4/strtod.m4 (gl_FUNC_STRTOD): Also check for hex-float parsing, + required for Solaris 10. + Reported by Bob Friesenhahn and Nelson H. F. Beebe. + 2008-04-04 Bruno Haible * modules/relocatable-prog-wrapper (Files): Add m4/environ.m4. Needed diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 7a10a21fcd..512746663a 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 7 +# strtod.m4 serial 8 dnl Copyright (C) 2002, 2003, 2006, 2007, 2008 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -22,15 +22,23 @@ AC_DEFUN([gl_FUNC_STRTOD], ]], [[ { /* Older glibc and Cygwin mis-parse "-0x". */ - char *string = "-0x"; + const char *string = "-0x"; char *term; double value = strtod (string, &term); if (1 / value != -HUGE_VAL || term != (string + 2)) return 1; } + { + /* Many platforms do not parse hex floats. */ + const char *string = "0XaP+1"; + char *term; + double value = strtod (string, &term); + if (value != 20.0 || term != (string + 6)) + return 1; + } { /* Many platforms do not parse infinities. */ - char *string = "inf"; + const char *string = "inf"; char *term; double value = strtod (string, &term); if (value != HUGE_VAL || term != (string + 3))