Subject: Re: strtod does not underflow
To: =?ISO-8859-1?Q?R=E9mi_Zara?= <remi_zara@mac.com>
From: Bruce ONeel <edoneel@sdf.lonestar.org>
List: port-mac68k
Date: 12/23/2004 14:12:26
Hi,
Last time  I had to do this I just untared the libc source from src.tgz,
cd'ed into the lib/libc directory, and typed make CC="cc -g" or so.

It's been a while and something might have changed.  Build.sh
might be better these days and there might be some clever
option to do this :-)

cheers

bruce

=?ISO-8859-1?Q?R=E9mi_Zara?= <remi_zara@mac.com> wrote:
> Date: Wed, 22 Dec 2004 20:19:48 +0100
> From: RZmi Zara <remi_zara@mac.com>
> Subject: Re: strtod does not underflow
> To: MacBSD <port-mac68k@NetBSD.org>
> 
> Hi,
> 
> Replying to my own mail:
> 
> I was hoping to debug the problem by compiling my test program  
> alongside  strtod.c from libc with debug options and tracing what was  
> happening.
> But doing this, strtod DOES underflow....
> 
> I guess I'll have to build a debugging libc...
> 
> Any directions for doing this ?
> 
> Regards,
> 
> RZmi Zara
> 
> Le 20 dZc. 04, š 23:19, RZmi Zara a Zcrit :
> 
> > Hi,
> >
> > Some postgresql regression tests fail on 2.0 mac68k because some  
> > double values do not undeflow.
> > (see for regression test log  
> > http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=osprey&dt=2004-12 
> > -20%2005:00:21)
> >
> > Here is a test program:
> >
> > test.c:
> >
> > #include <stdlib.h>
> > #include <errno.h>
> >
> > int main() {
> >         double res;
> >         double zero = 0.0;
> >         char *small = "10e-400";
> >         res = strtod(small,NULL);
> >         printf("%e, %d\n", res, errno);
> >         if (res == zero) {
> >                 printf("res == zero\n");
> >         }
> > }
> >
> > the output is:
> > #test
> > 0.000000e+00, 0
> > res == zero
> >
> > So strtod returned 0, but did not set errno to ERANGE (34)
> >
> > testing shows that 10e400 overflows, but to underflow, one must go to  
> > as little as 10e-512 (10e-511 shows the same result as 10e-400).
> >
> > So is there a bug in NetBSD's strtod ?
> > Is something wrong with the test program ?
> >
> > Regards,
> >
> > RZmi Zara
> > --
> > RZmi Zara
> > http://www.remi-zara.net/
> --
> RZmi Zara
> http://www.remi-zara.net/
> 
> [smime.p7s]