1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

* 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.
This commit is contained in:
Ulrich Drepper
2007-08-03 16:45:47 +00:00
parent ce31a3b1c5
commit 64f6281cbb
5 changed files with 217 additions and 4 deletions

View File

@ -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);
}