changeset 12247:963fbd66201a

strtod: detect darwin bug * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(". Reported by Leo Davis. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 05 Nov 2009 20:48:01 -0700
parents b156d2d1b827
children 1bc8eb7d006a
files ChangeLog m4/strtod.m4
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -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 @@
     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],