diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-08-03 16:45:47 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-08-03 16:45:47 +0000 |
commit | 64f6281cbb92c91989a51ca676eca245ea88228f (patch) | |
tree | 48f59140a01873ea839a1d0b5eea13577533f730 /stdlib/strtod_l.c | |
parent | ce31a3b1c588f8b8a5c7702c6460d6bd4386bd95 (diff) | |
download | glibc-64f6281cbb92c91989a51ca676eca245ea88228f.tar.gz glibc-64f6281cbb92c91989a51ca676eca245ea88228f.tar.xz glibc-64f6281cbb92c91989a51ca676eca245ea88228f.zip |
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Properly handle -0.
* stdlib/Makefile (tests): Add tst-strtod5. (tst-strtod5-ENV): New. * stdlib/tst-strtod5.c: New file.
Diffstat (limited to 'stdlib/strtod_l.c')
-rw-r--r-- | stdlib/strtod_l.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 4033e3bef8..939440f364 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -700,7 +700,8 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) #endif /* If TP is at the start of the digits, there was no correctly grouped prefix of the string; so no number found. */ - RETURN (0.0, tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp); + RETURN (negative ? -0.0 : 0.0, + tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp); } /* Remember first significant digit and read following characters until the @@ -759,7 +760,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) if (tp < startp) /* The number is validly grouped, but consists only of zeroes. The whole value is zero. */ - RETURN (0.0, tp); + RETURN (negative ? -0.0 : 0.0, tp); /* Recompute DIG_NO so we won't read more digits than are properly grouped. */ @@ -862,7 +863,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) { /* Overflow or underflow. */ __set_errno (ERANGE); - result = (exp_negative ? 0.0 : + result = (exp_negative ? (negative ? -0.0 : 0.0) : negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL); } |