delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/11/26/06:32:55

Date: Wed, 26 Nov 1997 13:32:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Morten Welinder <terra AT diku DOT dk>
cc: djgpp-workers AT delorie DOT com, dj AT delorie DOT com
Subject: Re: strtod.c
In-Reply-To: <199711260257.DAA27796@tyr.diku.dk>
Message-ID: <Pine.SUN.3.91.971126133138.960N-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019