strtod: detect darwin bug
authorEric Blake <ebb9@byu.net>
Fri, 6 Nov 2009 03:48:01 +0000 (20:48 -0700)
committerEric Blake <ebb9@byu.net>
Fri, 6 Nov 2009 04:00:23 +0000 (21:00 -0700)
* m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(".
Reported by Leo Davis.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
m4/strtod.m4

index 1635de2da9cc358f09eefd8089becbc982464ebc..23f8426668b9e2e7006e4217a29064bcb918ba7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-11-05  Eric Blake  <ebb9@byu.net>
 
+       strtod: detect darwin bug
+       * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(".
+       Reported by Leo Davis.
+
        freopen-safer: new module
        * modules/freopen-safer: New module.
        * m4/stdio-safer.m4 (gl_FREOPEN_SAFER): New macro.
index 9769436cb29ce4e114f4bff90e1003f91b32aa52..3bc87702581bb555f621384f95e32f78a0f4c2d1 100644 (file)
@@ -1,4 +1,4 @@
-# strtod.m4 serial 12
+# strtod.m4 serial 13
 dnl Copyright (C) 2002-2003, 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,6 +64,14 @@ numeric_equal (double x, double y)
     if (numeric_equal (value, value) || term != (string + 5))
       return 1;
   }
+  {
+    /* darwin 10.6.1 misparses "nan(".  */
+    const char *string = "nan(";
+    char *term;
+    double value = strtod (string, &term);
+    if (numeric_equal (value, value) || term != (string + 3))
+      return 1;
+  }
 ]])],
        [gl_cv_func_strtod_works=yes],
        [gl_cv_func_strtod_works=no],