delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/10/24/15:49:33.1

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3F997F7B.2EA5BEE7@phekda.freeserve.co.uk>
Date: Fri, 24 Oct 2003 20:37:31 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: strtod test takes a long time
References: <200306291425 DOT h5TEP4iB021922 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

ams AT ludd DOT luth DOT se wrote:
> 
> According to Richard Dawe:
> > The strtod test (tests/libc/ansi/stdlib/strtod.c) seems to take a long
> > time.
> 
> I've seen this too. And in my case it's gcc 2.95.{2,3}.
> 
> > DJGPP CVS built with gcc 3.2.2, binutils 2.13 on an Athlon 850MHz:
> >
> > bash-2.04$ time ./strtod.exe
> >                 0e20  ->  0
> >                1e200  ->  1e+200
> >         0e2000000000  ->  0
> 
> IIRC, this was a bad one considering the result should be 0 which
> can be seen early.
> 
> > I'm wondering if we could exit strto* faster, when the exponent is larger
> > than one we support (*_MAX_EXP from <float.h>.
> 
> Sounds good.

Unfortunately I don't think is as simple as it sounds. Consider a number like
this:

    0.0000000000000000000000000000000000000000000000006e309

Considering the exponent alone, you would think that the number is greater
than that allowed for double. But it's a valid double, after you've cancelled
powers of 10 from the decimals and the exponent.

I guess we could count the number of zeroes after the decimal point and use
that in some calculation with the exponent.

I'm not sure I want to mess with this just before a beta.

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

"You can't evaluate a man by logic alone." -- McCoy, "I, Mudd", Star Trek

- Raw text -


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