X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1/bN9VX0gHbozQWxpg/yePxDmAnL88vr4iR0SwqL9 Eg0YWlPJX+eopf From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Bug fix for strtold Date: Tue, 8 Apr 2008 17:19:39 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804081719.40163.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com Given a string like this: "123.456 E+12" strtof and strtod return 0.0 and point to the first character of the string, meanwhile strtold returns the value 123.456 and points to the space character between mantissa and "E+12". I assume that all functions should behave identically in this case. 2008-04-08 Juan Manuel Guerrero * src/libc/ansi/stdlib/strtold.c: Do not return the mantissa of a floating point number if the exponent conversion failed. Index: src/libc/ansi/stdlib/strtold.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdlib/strtold.c,v retrieving revision 1.10 diff -U3 -r1.10 strtold.c --- src/libc/ansi/stdlib/strtold.c 8 Nov 2003 12:19:40 -0000 1.10 +++ src/libc/ansi/stdlib/strtold.c 8 Apr 2008 15:17:32 -0000 @@ -33,9 +33,13 @@ e = ne = 0; esign = 1; + if (sret) + *sret = unconst(s, char *); + while(*s && isspace((unsigned char)*s)) s++; + /* Handle leading sign. */ if (*s == '+') s++; else if (*s == '-') @@ -137,12 +141,12 @@ ne++; } } + if (flags == 0) - { - if (sret) - *sret = unconst(s, char *); return 0.0L; - } + + if (sret) + *sret = unconst(s, char *); if ((*s == 'e') || (*s == 'E')) {