Improve strtod bug detection check.
authorEric Blake <ebb9@byu.net>
Fri, 4 Apr 2008 04:37:49 +0000 (22:37 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 4 Apr 2008 12:29:39 +0000 (06:29 -0600)
* 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>
ChangeLog
m4/strtod.m4

index 950a574..a1a3041 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 7a10a21..5127466 100644 (file)
@@ -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))