Date: Thu, 16 Jul 1998 13:32:49 +0300 (IDT) From: Eli Zaretskii To: DJ Delorie cc: djgpp-workers AT delorie DOT com, Kbwms AT aol DOT com Subject: Re: 2.02 alpha 980712 In-Reply-To: <199807131253.IAA16812@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Here's a patch which corrects `strtod' behavior in cases like "-211.8+", "0e+1" and "3.e+". Many thanks to K.B. Williams for help in testing this. *** src/libc/ansi/stdlib/strtod.c~0 Thu Jan 1 23:10:54 1998 --- src/libc/ansi/stdlib/strtod.c Sat Jul 11 10:38:36 1998 *************** strtod(const char *s, char **sret) *** 24,29 **** --- 24,32 ---- e = 0; esign = 1; + if (sret) + *sret = unconst(s, char *); + while ((*s == ' ') || (*s == '\t')) s++; *************** strtod(const char *s, char **sret) *** 56,67 **** } } ! if (flags == 0 || r == 0) ! { ! if (sret) ! *sret = unconst(s, char *); return 0; ! } if ((*s == 'e') || (*s == 'E')) { --- 59,69 ---- } } ! if (flags == 0) return 0; ! ! if (sret) ! *sret = unconst(s, char *); if ((*s == 'e') || (*s == 'E')) { *************** strtod(const char *s, char **sret) *** 74,84 **** esign = -1; } if ((*s < '0') || (*s > '9')) ! { ! if (sret) ! *sret = unconst(s, char *); ! return r; ! } while ((*s >= '0') && (*s <= '9')) { --- 76,82 ---- esign = -1; } if ((*s < '0') || (*s > '9')) ! return r * sign; while ((*s >= '0') && (*s <= '9')) {