This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [BIB PATCH] Compile-time sqrt error analysis
- From: Brad Lucier <lucier at math dot purdue dot edu>
- To: roger at www dot eyesopen dot com
- Cc: lucier at math dot purdue dot edu (Brad Lucier), gcc-patches at gcc dot gnu dot org
- Date: Wed, 11 Dec 2002 16:28:21 -0500 (EST)
- Subject: Re: [BIB PATCH] Compile-time sqrt error analysis
Roger:
Nice work.
I believe that because of GCC's 160-bit internal accuracy, that
compile-time sqrt's will be exact for any fp format with <= 78 bits
precision (from the HP paper you cited earlier). My guess is that
if you test this on an architecture with more precision (say, 128-bit
fp on various machines, including the two-word version on PowerPC)
then you will find some errors > 1/2. (But it would take a *long* time
to find such examples using maple and Gaston's program.)
Is there some way to apply this optimization only to constants that
have precision shorter than a certain amount?
BTW,
double y, x;
y = sqrt(x);
really means "convert x to extended double; take the correctly-rounded
extended double square root of converted x (note the "correctly-rounded"
here); correctly round this number to double precision". bc gives
0.5/0.00024
2083
which is just about the extra 11 bits precision you get going from double
precision to extended precision.
Brad