From eb81ccc4ebcba81ae42ef4b6c480d0e7d28fea1e Mon Sep 17 00:00:00 2001 From: Daniel Richard G Date: Wed, 17 Aug 2016 17:36:24 -0700 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ lib/strtod.c | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e9faa25d8..d5883cf3cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +2016-08-17 Daniel Richard G. + + strtod: port to z/OS + * lib/strtod.c (strtod): Address a couple quirks in the z/OS + implementation. + 2016-08-17 Paul Eggert + 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. diff --git a/lib/strtod.c b/lib/strtod.c index 2db7c7349c..34c6c4237e 100644 --- a/lib/strtod.c +++ b/lib/strtod.c @@ -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; } -- 2.39.5