]> Savannah Git Hosting - gnulib.git/commitdiff
strtod: port to z/OS
authorDaniel Richard G <skunk@iSKUNK.ORG>
Thu, 18 Aug 2016 00:36:24 +0000 (17:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 18 Aug 2016 00:44:56 +0000 (17:44 -0700)
* lib/strtod.c (strtod): Address a couple quirks in the z/OS
implementation.

strtod: port to z/OS
* lib/strtod.c (strtod): Address a couple quirks in the z/OS
implementation.

ChangeLog
lib/strtod.c

index 5e9faa25d85a690e85347384239dab4e8c5c8511..d5883cf3cffc13709fc9a2dc6b8afecc412ad9f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2016-08-17  Daniel Richard G.  <skunk@iSKUNK.ORG>
+
+       strtod: port to z/OS
+       * lib/strtod.c (strtod): Address a couple quirks in the z/OS
+       implementation.
+
 2016-08-17  Paul Eggert  <eggert@cs.ucla.edu>
 
+       strtod: port to z/OS
+       * lib/strtod.c (strtod): Address a couple quirks in the z/OS
+       implementation.
+
        regex, string: rename to avoid '__string'
        * lib/regex.h, lib/string.in.h: Do not use the identifier
        '__string', as it is effectively reserved by string.h on z/OS.
index 2db7c7349cac43e997f07eaf48c8aef47edb288d..34c6c4237ebd4178498187d809ffbd1a6276d07a 100644 (file)
@@ -239,7 +239,12 @@ strtod (const char *nptr, char **endptr)
       if (*s == '0' && c_tolower (s[1]) == 'x')
         {
           if (! c_isxdigit (s[2 + (s[2] == '.')]))
-            end = s + 1;
+            {
+              end = s + 1;
+
+              /* strtod() on z/OS returns ERANGE for "0x".  */
+              errno = 0;
+            }
           else if (end <= s + 2)
             {
               num = parse_number (s + 2, 16, 2, 4, 'p', &endbuf);
@@ -321,7 +326,7 @@ strtod (const char *nptr, char **endptr)
          better to use the underlying implementation's result, since a
          nice implementation populates the bits of the NaN according
          to interpreting n-char-sequence as a hexadecimal number.  */
-      if (s != end)
+      if (s != end || num == num)
         num = NAN;
       errno = saved_errno;
     }