bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] strtod: support coreutils better


From: Paul Eggert
Subject: [PATCH] strtod: support coreutils better
Date: Tue, 19 Feb 2013 14:21:15 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

---
 ChangeLog    |  6 ++++++
 lib/strtod.c | 19 +++----------------
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 79bda70..4f3a198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-02-19  Paul Eggert  <address@hidden>
 
+       strtod: support coreutils better
+       * lib/strtod.c (underlying_strtod): Just invoke the underlying strtod.
+       HAVE_RAW_DECL_STRTOD might not be correct in coreutils, which
+       disables the raw decl checks.  This assumes there is an underlying
+       strtod, but that's a safe assumption these days.
+
        mountlist: port to HP NonStop
        Reported by Joachim Schmitz in
        <http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00084.html>.
diff --git a/lib/strtod.c b/lib/strtod.c
index 5c43b4f..cf59cd5 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -344,24 +344,11 @@ strtod (const char *nptr, char **endptr)
   return negative ? -num : num;
 }
 
-/* The "underlying" strtod implementation.  This must be defined
+/* The underlying strtod implementation.  This must be defined
    after strtod because it #undefs strtod.  */
 static double
 underlying_strtod (const char *nptr, char **endptr)
 {
-  if (HAVE_RAW_DECL_STRTOD)
-    {
-      /* Prefer the native strtod if available.  Usually it should
-         work and it should give more-accurate results than our
-         approximation.  */
-      #undef strtod
-      return strtod (nptr, endptr);
-    }
-  else
-    {
-      /* Approximate strtod well enough for this module.  There's no
-         need to handle anything but finite unsigned decimal
-         numbers with nonnull ENDPTR.  */
-      return parse_number (nptr, 10, 10, 1, 'e', endptr);
-    }
+#undef strtod
+  return strtod (nptr, endptr);
 }
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]