changeset 9871:faf4392efa56

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 <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 03 Apr 2008 22:37:49 -0600
parents dc081233a868
children 8724fb6c1548
files ChangeLog m4/strtod.m4
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 04 04:23:39 2008 +0200
+++ b/ChangeLog	Thu Apr 03 22:37:49 2008 -0600
@@ -1,3 +1,10 @@
+2008-04-04  Eric Blake  <ebb9@byu.net>
+
+	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  <bruno@clisp.org>
 
 	* modules/relocatable-prog-wrapper (Files): Add m4/environ.m4. Needed
--- a/m4/strtod.m4	Fri Apr 04 04:23:39 2008 +0200
+++ b/m4/strtod.m4	Thu Apr 03 22:37:49 2008 -0600
@@ -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 @@
 ]], [[
   {
     /* 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))