This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]