This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fix strtod("-0x",NULL)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Jeff Johnston on 2/21/2008 8:59 AM:
|> strtod is required to parse out the longest sequence of the expected
|> form.  Since "-0x" is not a valid hex constant, strtod should fall
|> back and parse the valid "-0" as -0.0, rather than claiming that the
|> input is invalid and returning +0.0.  OK to apply?

And another one - strtod("nan()", ptr) should consume the () (per C99, the
n-char-sequence between the literal () is optional, not required).
Without the patch, ptr is set to str+3 instead of str+5.  OK to apply?

2008-02-29 Eric Blake <ebb9@byu.net>

	Fix strtod("nan()", ptr).
	* libc/stdlib/gdtoa-hexnan.c (hexnan): When the optional
	n-char-sequence is omitted, still parse the ().

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHx4ra84KuGfSFAYARApQtAKDFS9LK859EtElZv2qCdbkhe8TDOwCgsNI/
0uqPgc34aCrupluyduEDihk=
=N3vo
-----END PGP SIGNATURE-----
Index: libc/stdlib/gdtoa-hexnan.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/gdtoa-hexnan.c,v
retrieving revision 1.1
diff -u -p -r1.1 gdtoa-hexnan.c
--- libc/stdlib/gdtoa-hexnan.c	22 Jun 2006 17:59:52 -0000	1.1
+++ libc/stdlib/gdtoa-hexnan.c	29 Feb 2008 04:26:54 -0000
@@ -98,7 +98,7 @@ _DEFUN (hexnan, (sp, fpi, x0),
 					}
 				continue;
 				}
-			if (/*(*/ c == ')' && havedig) {
+			if (/*(*/ c == ')') {
 				*sp = s + 1;
 				break;
 				}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]