Mail Archives: djgpp-workers/1997/11/26/06:32:55
On Wed, 26 Nov 1997, Morten Welinder wrote:
> Your patch looks ok, but what about "1e-2000000000"?
You're on! (Let's see how much more code bloat from me can DJ accept ;-)
diff -c src/libc/ansi/stdlib/strtod.c~0 src/libc/ansi/stdlib/strtod.c
*** src/libc/ansi/stdlib/strtod.c~0 Wed Nov 26 12:39:26 1997
--- src/libc/ansi/stdlib/strtod.c Wed Nov 26 13:09:42 1997
***************
*** 95,101 ****
--- 95,109 ----
}
else if (esign < 0)
for (i = 1; i <= e; i++)
+ {
r *= 0.1L;
+ if (r < DBL_MIN) /* detect underflow */
+ {
+ errno = ERANGE;
+ r = 0.0;
+ break;
+ }
+ }
else
for (i = 1; i <= e; i++)
{
- Raw text -