diff lib/strtod.c @ 18377:e27b495de32b

strtod: port to z/OS * 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.
author Daniel Richard G <skunk@iSKUNK.ORG>
date Wed, 17 Aug 2016 17:36:24 -0700
parents 31b2239ca59c
children 296222d9cae1
line wrap: on
line diff
--- a/lib/strtod.c	Wed Aug 17 17:24:11 2016 -0700
+++ b/lib/strtod.c	Wed Aug 17 17:36:24 2016 -0700
@@ -239,7 +239,12 @@
       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 @@
          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;
     }