Fix strtod("-0x", NULL).
* libc/stdlib/strtod.c (_strtod_r): Fall back to 0 if hex parse fails.
This commit is contained in:
parent
1f71763a62
commit
7a44c13ecb
@ -1,3 +1,9 @@
|
||||
2008-02-21 Eric Blake <ebb9@byu.net>
|
||||
|
||||
Fix strtod("-0x", NULL).
|
||||
* libc/stdlib/strtod.c (_strtod_r): Fall back to 0 if hex parse
|
||||
fails.
|
||||
|
||||
2008-02-12 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/machine/powerpc/vfprintf.c (_VFPRINTF_R): Prepare
|
||||
@ -20,12 +26,12 @@
|
||||
str[n]cpy and str[n]cat.
|
||||
* libc/machine/spu/strncat.c: Use _straddr and _strcpy.
|
||||
* libc/machine/spu/strncpy.c: Use _strcpy.
|
||||
|
||||
|
||||
2008-02-11 Patrick Mansfield <patmans@us.ibm.com>
|
||||
|
||||
* libc/machine/spu/strlen.c: Remove the len variable and unneeded
|
||||
calculation of its value.
|
||||
|
||||
|
||||
2008-01-25 Hans-Peter Nilsson <hp@bitrange.com>
|
||||
|
||||
* libc/sys/mmixware/isatty.c (_isatty): Renamed from isatty.
|
||||
@ -138,20 +144,20 @@
|
||||
|
||||
2007-12-19 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* NEWS: Update with 1.16.0 info.
|
||||
* README: Ditto.
|
||||
* acinclude.m4: Change version number to 1.16.0.
|
||||
* aclocal.m4: Regenerated.
|
||||
* configure: Ditto.
|
||||
* doc/aclocal.m4: Ditto.
|
||||
* doc/configure: Ditto.
|
||||
* libc/*/aclocal.m4: Ditto.
|
||||
* libc/*/configure: Ditto.
|
||||
* libc/libc.texinfo: Ditto.
|
||||
* libm/*/aclocal.m4: Ditto.
|
||||
* libm/*/configure: Ditto.
|
||||
* libm/libm.texinfo: Ditto.
|
||||
* libc/sys/linux/shared.ld: Add VERS_1.16.
|
||||
* NEWS: Update with 1.16.0 info.
|
||||
* README: Ditto.
|
||||
* acinclude.m4: Change version number to 1.16.0.
|
||||
* aclocal.m4: Regenerated.
|
||||
* configure: Ditto.
|
||||
* doc/aclocal.m4: Ditto.
|
||||
* doc/configure: Ditto.
|
||||
* libc/*/aclocal.m4: Ditto.
|
||||
* libc/*/configure: Ditto.
|
||||
* libc/libc.texinfo: Ditto.
|
||||
* libm/*/aclocal.m4: Ditto.
|
||||
* libm/*/configure: Ditto.
|
||||
* libm/libm.texinfo: Ditto.
|
||||
* libc/sys/linux/shared.ld: Add VERS_1.16.
|
||||
|
||||
2007-12-19 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
|
@ -14,7 +14,7 @@ ANSI_SYNOPSIS
|
||||
double strtod(const char *<[str]>, char **<[tail]>);
|
||||
float strtof(const char *<[str]>, char **<[tail]>);
|
||||
|
||||
double _strtod_r(void *<[reent]>,
|
||||
double _strtod_r(void *<[reent]>,
|
||||
const char *<[str]>, char **<[tail]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
@ -37,12 +37,19 @@ DESCRIPTION
|
||||
producing a substring which can be converted to a double
|
||||
value. The substring converted is the longest initial
|
||||
subsequence of <[str]>, beginning with the first
|
||||
non-whitespace character, that has the format:
|
||||
.[+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]
|
||||
non-whitespace character, that has one of these formats:
|
||||
.[+|-]<[digits]>[.[<[digits]>]][(e|E)[+|-]<[digits]>]
|
||||
.[+|-].<[digits]>[(e|E)[+|-]<[digits]>]
|
||||
.[+|-](i|I)(n|N)(f|F)[(i|I)(n|N)(i|I)(t|T)(y|Y)]
|
||||
.[+|-](n|N)(a|A)(n|N)[<(>[<[hexdigits]>]<)>]
|
||||
.[+|-]0(x|X)<[hexdigits]>[.[<[hexdigits]>]][(p|P)[+|-]<[digits]>]
|
||||
.[+|-]0(x|X).<[hexdigits]>[(p|P)[+|-]<[digits]>]
|
||||
The substring contains no characters if <[str]> is empty, consists
|
||||
entirely of whitespace, or if the first non-whitespace
|
||||
character is something other than <<+>>, <<->>, <<.>>, or a
|
||||
digit. If the substring is empty, no conversion is done, and
|
||||
digit, and cannot be parsed as infinity or NaN. If the platform
|
||||
does not support NaN, then NaN is treated as an empty substring.
|
||||
If the substring is empty, no conversion is done, and
|
||||
the value of <[str]> is stored in <<*<[tail]>>>. Otherwise,
|
||||
the substring is converted, and a pointer to the final string
|
||||
(which will contain at least the terminating null character of
|
||||
@ -52,7 +59,8 @@ DESCRIPTION
|
||||
|
||||
This implementation returns the nearest machine number to the
|
||||
input decimal string. Ties are broken by using the IEEE
|
||||
round-even rule.
|
||||
round-even rule. However, <<strtof>> is currently subject to
|
||||
double rounding errors.
|
||||
|
||||
The alternate function <<_strtod_r>> is a reentrant version.
|
||||
The extra argument <[reent]> is a pointer to a reentrancy structure.
|
||||
@ -176,7 +184,7 @@ _DEFUN (ULtod, (L, bits, exp, k),
|
||||
L[_0] |= 0x80000000L;
|
||||
}
|
||||
#endif /* !NO_HEX_FP */
|
||||
|
||||
|
||||
#ifdef INFNAN_CHECK
|
||||
static int
|
||||
_DEFUN (match, (sp, t),
|
||||
@ -254,6 +262,9 @@ _DEFUN (_strtod_r, (ptr, s00, se),
|
||||
switch(s[1]) {
|
||||
case 'x':
|
||||
case 'X':
|
||||
/* If the number is not hex, then the parse of
|
||||
0 is still valid. */
|
||||
s00 = s + 1;
|
||||
{
|
||||
#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) && defined(FE_TOWARDZERO) && defined(FE_UPWARD)
|
||||
FPI fpi1 = fpi;
|
||||
@ -268,7 +279,6 @@ _DEFUN (_strtod_r, (ptr, s00, se),
|
||||
switch((i = gethex(ptr, &s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
|
||||
case STRTOG_NoNumber:
|
||||
s = s00;
|
||||
sign = 0;
|
||||
case STRTOG_Zero:
|
||||
break;
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user